CheckStyle IDEA using suppression file for custom checks - checkstyle

I have a maven repo with custom checks which I want all the other maven repos to depend on. I want to suppress checks for some generated code in one of my repos. There are 2 ways I can setup suppression file:
Have suppression file in the custom check repo, then specify SuppressionFilter in custom check style xml:
<module name="SuppressionFilter">
<property name="file" value="${samedir}/checkstyle_suppressions.xml"
default="src/main/resources/checkstyle_suppressions.xml"/>
</module>
Then in the maven plugin section of the pom.xml file of repo that I want to run custom checkstyle on:
<suppressionsLocation>checkstyle_suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
Do not put the SuppressionFilter section in the custom checkstyle xml. Have the same pom.xml setup for the repo to be checked. The suppression file can be placed local to the repo to be checked.
Both of the approach work with command line "mvn clean validate". But neither works with CheckStyle IDEA plugin for Intellij. The Intellij plugin complains it couldn't find the suppression file for the 1st method above.
I don't want to force every repo to have a suppression file if they don't need it. I wonder if there is a way to make suppression work for CheckStyle IDEA without having to have multiple copies of the same suppression file (1 in custom check repo, 1 in local repo).
Thanks!

The logic the plugin uses is
does the file path resolve?
does the file path exist relative to the rules file?
does the file path exist relative to the module content roots, the module file or the project base directory?
If not, it gives up. So there's two possibilities:
there's a bug in the logic. Raise an issue on GitHub please.
it doesn't fit your use case. Raise a feature feature on GitHub, with a example to reproduce the problem and how you think resolution should be changed to fit your needs.
The code's in the resolveAssociatedFile method of https://github.com/jshiell/checkstyle-idea/blob/master/src/main/java/org/infernus/idea/checkstyle/model/ConfigurationLocation.java if you're interested.

Related

SonarLint.xml is added to every VS project? Where can I read about it?

When I integrated SonarLint into my VS solution, I got a SonarLint.xml file ref. for every project. I wonder, how it is used? Can I remove this reference? Couldn't find any documentation about it.
When I integrated SonarLint into my VS solution, I got a SonarLint.xml file ref. for every project.
This is needed and by-design. The file contains code quality rule parameters used by SonarLint. Example parameter:
<Rule>
<Key>S103</Key>
<Parameters>
<Parameter>
<Key>maximumLineLength</Key>
<Value>200</Value>
When you bind or update your solution from SonarQube, a master SonarLint.xml file gets downloaded into your solution's .sonarlint folder; and a soft-link file to this master file is added to every project being analyzed.
(The SonarLint NuGet apparently does not or cannot access the master SonarLint.xml file, so it needs a project-level SonarLint.xml soft-link file.)

BigCommerce stencil bundle theme validating issues in schema.json file

Hello developers out here!
I struggle with stencil bundle and stencil push issues.
I get error at "Validating theme..."
Error: Your theme's schema.json has errors:
schema[1].settings[28].options[0].value should be string,number
schema[1].settings[28].options[1].value should be string,number
...
It seems that I get this issue after try to test latest cornerstone (5.4.5) theme version, and update stencil-cli and now I can't use oldest version (1.10.0) schema.json file -> https://github.com/bigcommerce/cornerstone/blob/1.10.0/schema.json
Now it only works with these two files:
schema.json -> https://github.com/bigcommerce/cornerstone/blob/4.5.4/schema.json
schemaTranslations.json -> https://github.com/bigcommerce/cornerstone/blob/4.5.4/schemaTranslations.json
But I am not sure how it would impact live site work if I use different schema files.
It is possible to work again with old schema.json file?
Previously all worked...
I tried to:
delete all node_modules
reinstall #bigcommerce/stencil-cli
and node modules (npm install)
These look similar to errors when the schema.json or schemaTranslations.json file have been removed or modified, could you add any relevant schema code in your post? Since Stencil CLI 2.0, part of the bundle process now validates a schemaTranlsations.json file which has been included since Cornerstone 4.5.4. This change can be found on the GitHub repo here as well as on our DevCenter Changelog.
Hello #dakterits and #kyle-obrien
The error which you mentioned means that option number 0 and 1 in setting number 28 in the schema file has either empty value or different value. So, to fix this issue, you don't have downgrade the node or reinstall stencil or delete any file.
The Solution:
Download the original copy of the theme.
Edit the original theme schema file.
If you have any file compare software then compare edited theme schema with original theme schema.
Once you compare, you will definitely see any change in value in defined settings.

Cactoos Checkstyle Configuration File

I've installed the checkstyle-idea (v8.16) for IntelliJ, there are two options of Configuration files, 'Sun Checks' and 'Google Checks'.
Is there a specific file for Cactoos project? Because both default options are not working when I check all the project, it returns a tone of error style from the source that is already committed at origin/master
Thank you
No, there isn't.
Cactoos uses qulice for static code analysis in its maven build.
Furthermore, Qulice aggregates several analyzers - not just checkstyle - with custom configuration (and checks in some cases).
So even if you installed plugins for all the analyzers that qulice aggregates (checkstyle, findbugs, etc), you'd have to somehow import those custom checks as well.

Is it possible to customize Visual Studio 2017 SSRS rptproj MSBuild files?

My company has made extensive investments into a library of custom MSBuild targets files that we use to build our full product. Every project file we have in source control imports at least one custom targets file, which all ultimately end up importing a core targets file that contains the bulk of our general-use targets & properties.
Recently we added a new SSRS project to our solution, and this project (I believe) is the new rptproj format introduced in late 2017--in particular, it declares ToolsVersion="15.0" and imports Microsoft.ReportingServices.MSBuilder.targets from within the VS 2017 install directory.
The problem I'm experiencing is that none of the logical changes I make to the rptproj file appear to do anything; importing our shared targets file doesn't result the execution of any of our targets, such as targets declaring BeforeTargets="BeforeBuild" or even set against the ReportingServices-specific target with BeforeTargets="ReportBuilderTarget".
Furthermore, attempting to set the OutputPath results in exceedingly weird behavior. Declaring an OutputPath such as the following:
<OutputPath>$(SharedOutputPath)SSRS\$(MSBuildProjectName)</OutputPath>
...will result after build in the following folder within the project file's directory:
C:\workspace\solutionfolder\ReportProject1\$(SharedOutputPath)SSRS\$(MSBuildProjectFile)
This is weird because it's not even interpreting the well-known metadata token $(MSBuildProjectName) as a property, and emitting both it as well as $(SharedOutputPath) as string literals into the OutputPath property.
Furthermore, saving the rptproj file in VS results in a total wipe of all customizations to the file.
Reviewing the Microsoft.ReportingServices.MSBuilder.targets file, it seems as though it does some extensive gutting of the base Microsoft.Common.targets file, but in no way that I can imagine would prevent the basic usage of MSBuild properties or anything.
That's about the the extent of my MSBuild knowledge though so I'm not sure where to take it from here.
Overall it seems like MSBuild support for rptproj files is somewhat half-baked, but am I missing something?
Is it possible to customize Visual Studio 2017 SSRS rptproj MSBuild files?
As workaround, yon can build the project with MSBuild command line.
As test, I overwrite the default OutputPath for SSRS rptproj to:
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<FullPath>Debug</FullPath>
<OutputPath>bin\Debug\$(MSBuildProjectName)</OutputPath>
...
</PropertyGroup>
And add a custom target in the .rptproj file:
<Target Name="Test" BeforeTargets="BeforeBuild">
<Message Text="$(OutputPath)"></Message>
</Target>
Then I build the project with MSBuild command line:
msbuild "<ProjectPath>.rptproj" /property:Configuration=Debug
As result:
And the build file build.obj was generated in the bin\Debug\Report Project1 folder.
Hope this helps.

How do I include configuration files with Maven Appassembler?

I'm using the Maven Appassembler plugin to package my application. I'd like to package some configuration files with the application. I've found the configurationDirectory and includeConfigurationDirectoryInClasspath parameters, but I haven't found how I should create (and populate) that configuration directory. I've tried putting the files in src/main/resources, but that just puts them in the jar file for my project.
What is the "proper" way to do this, using maven?
Unfortunately this is a limitation of the appassembler plugin in the current release version. Typically, the plugin is used in conjunction with the assembly plugin to produce the final artifact, in which you can include the reference to your configuration directory. However, if you'd like to have a functional structure from just the appassembler plugin you need to manually copy the files into place. An example using the antrun plugin with a src/main/conf directory can be found here: http://svn.apache.org/viewvc/archiva/trunk/archiva-jetty/
By default, the plugin uses the directory src/main/config.
Is possible to change the source for the config files using the parameter <configurationSourceDirectory>src/main/config</configurationSourceDirectory>
When I include the copyConfigurationDirectory property, it copies the config files and bundles them properly.
<configurationDirectory>etc</configurationDirectory>
<configurationSourceDirectory>src/main/config</configurationSourceDirectory>
<copyConfigurationDirectory>true</copyConfigurationDirectory>
I have a different problem though. I would like to filter my config files before copying, which is giving me some trouble.
Apart from that is does not generate the bin scripts for different platforms. The maven-assembly-plugin can create (package(s) {tar.gz, zip}) for distribution. These are configured through a assemble.xml. You specify which files go in (with what options (chmod)), etc. It can also filter files (search/replace values within them). etc.
Years later and in version 1.10 of the plugin there is now a preAssembleDirectory configuration option. Unfortunately I don't find it flexible enough for my needs because it copies directly into assembleDirectory and does not allow to specify a target directory path within assembleDirectory.