Yamllint exclude # symbol check in application.yaml file - spring-boot

I have used linter to lint spring-boot framework application.yaml file:
---
spring:
application:
name: #project.name#
#project.name# value allows spring-boot application to resolve application name from pom.xml file.
However when I run linter (yamllint ./src/main/) I get an error:
Error: ./src/main/resources/application.yaml:4:11: [error] syntax error: found character '#' that cannot start any token (syntax)
Is there any rule how can I exclude special characters check?

That's a syntax error. yamllint uses PyYAML for parsing, which yields this error. PyYAML obviously cannot ignore a syntax error, and by extension, yamllint cannot ignore it.
Your best bet is to preprocess the file to replace all referenced variables, e.g.
sed -E 's/#([^#]*)#/_\1_/g' application.yaml | yamllint -
This replaces the # characters around variable references with _, which keeps the line length.

Related

Spring Boot 3: Can't set logging.pattern.console in application.yaml

I'm trying to add a "correlation-id" to the logs that are written by my Spring-Boot application.
For that I've taken the spring-boot logback default value and added it to my application.yaml, which looks like this:
logging:
pattern:
console: ${CONSOLE_LOG_PATTERN:-%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd'T'HH:mm:ss.SSSXXX}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}
But now my application isn't starting anymore and fails with:
Could not copy file '/my-project/src/main/resources/config/application.yaml' to '/my-project/build/resources/main/config/application.yaml'.
Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript62.groovy: 1: Unexpected input: '(' # line 1, column 10.
out.print("""spring:
Putting "" around the pattern doesn't help
replacing ":-" with ":" doesn't make a difference
Removing all the variables (and putting "" around the pattern) works
Setting the pattern as an environment variable works too
Is there something missing in my approach? I would prefer to have this change in my application.yaml instead of an environment variable so that not everyone needs to configure it locally to have the same log output as it is expected on production.
I'm using Spring-Boot 3.0.2 with gradle 7.6

sigs.k8s.io/kustomize/kustomize/v3#v3.8.7 (in sigs.k8s.io/kustomize/kustomize/v3#v3.8.7):

I was setting up kubearmor developement environment, I used make deploy command and it started downloading sigs.k8s.io/kustomize/kustomize/v3#v3.8.7
and the following error was shown in command line. What should i do?
go: sigs.k8s.io/kustomize/kustomize/v3#v3.8.7 (in sigs.k8s.io/kustomize/kustomize/v3#v3.8.7): The go.mod file for the module providing named packages contains one or more exclude directives. It must not contain directives that would cause it to be interpreted differently than if it were the main module. make: *** [Makefile:142: kustomize] Error 1
i didn't try anything yet

Appcelerator Android Packaging Failed

Getting what appears to be a simple error and I have no idea how to resolve it:
res/drawable/DefaultIcon.png: Invalid file name: must contain only [a-z0-9_.]
The problem with the error is apparent. DefaultIcon.png is already alphabetical. How do I resolve this strange bug so I can package my app for the app store?
This regular expression tells that you have to use only lower-case alphabets, or 0-9 digits, or an underscore or a period (.).
Change the filename to all lowercases like defaulticon.png & it will work.
When I used a file name as DefaultIcon.png, I got the same error.
Then I renamed that file to all lower-cases alphabets & it worked fine.

Yaml Exception : Unable to parse (near "apply_to: "\.css$"")

Since I have migrated to Symfony3 (from Symfony 2.8), I have an exception when the config.yml is parsing :
Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
The file "/home/public_html/app/config/config.yml"
does not contain valid YAML.
[Symfony\Component\Yaml\Exception\ParseException]
Unable to parse at line 60 (near "apply_to: "\.css$"").
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: ["MyBundle"]
java: /usr/bin/java
ruby: /usr/bin/ruby
filters:
cssrewrite: ~
sass:
bin: /usr/bin/sass
compass:
bin: /usr/bin/compass
yui_css:
jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar"
apply_to: "\.css$"
yui_js:
jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar"
apply_to: "\.js$"
During my passage to SF2.8 to SF3.0 this code has not changed. The documentation has not changed too : http://symfony.com/doc/current/cookbook/assetic/apply_to_option.html
If I replace:
apply_to: "\.css$"
By:
apply_to: ".css$"
I have not error, but this is not the good result.
Do you know why I couldn't wrote apply_to: ".css$" as the doc?
Sorry for my bad English...
The S3 yaml implementation now follows the yaml standards a bit more closely. http://symfony.com/doc/current/components/yaml/yaml_format.html#strings
So replace your double quotes with single quotes and all should be well. Or use \. Keep in mind that S3 is not backwards compatible with S2 so you will probably run into a bunch of these issues when trying to upgrade existing projects.
And be sure to quote any #service_ids

Pylint: "locally defined disables" still give warnings. How to suppress them?

I work with a software framework which has a couple of classes with method names containing capital letters (due to C++ wrappers). This is of course not PEP8 and pylint shows the corresponding error C0103. I also added C0111 to the list to ignore the missing docstrings for some methods, like this:
def Configure(self): # pylint: disable=C0103,C0111
It works, however now I get warnings because of the local disablings:
Class: I0011 -> locally disabling C0103
Class: I0011 -> locally disabling C0111
How should I suppress them?
OK, so obviously one has to ignore the ignore-warning explicitly. One can do this in the pylint config file: if you don't have one, simply generate a standard configuration via
pylint --generate-rcfile > pylint.rc
and uncomment the line with disable=... and add I0011 to the list. This suppresses all warnings regarding "locally defined disablings".
The other method is to add the following line to the beginning of a file (or block, whatever), if you don't want to suppress the warning globally:
#pylint: disable=I0011

Resources