How to execute findbugs programmatically with selected rules and classes? - static-analysis

I have a very large code base.
I would like to execute findbugs programmatically on selected class files with just a selected set of rules at a time so that the analysis can finish in a few seconds. Documentation for includes/excludes say that only matching patterns will be reported, but does not clarify whether all the rules will be processed or only the selected ones.
Would like to know where I can start?

If you are using ant and findbugs anttask, to run a selected set of bug-detectors, use the "visitors" parameter/attribute.
More details here:
http://findbugs.sourceforge.net/manual/anttask.html
To run on selected classes only, I just jar-ed the selected classes in a separate jar and pointed the ant task to it via the "class" sub-tag.

Related

Is there a way to specify a where condition for all tests in a model in DBT?

I would like to write some tests for my dbt model. I only want the tests to test certain rows (data within the last month). I could write a where clause for every single test in yml file like so:
- not_null
config:
where: "current_date-date_column<=30"
However, I was wondering if there is some shortcut to put the clause on the model and have the where clause apply to all tests of the model (which is a lot easier to write and also means I don't have to worry about forgetting if I add more tests).
This article givers an example on how to do that for project level but I don't want the whole project just one model.
Any config that can be applied in the dbt_project.yml can be scoped to specific directories or resources. However, tests are their own resources, independent of the models they test, and currently (dbt v1.2), it is not possible apply config to all tests for a given model.
As a workaround, you could consider putting the .yml file that defines the tests for that model in a directory by itself, and applying the config to a directory.
Apply where to a whole project:
tests:
+where: "date_column = current_date"
Apply where only to .yml files nested in the models/marts/finance/ directory:
tests:
my_project:
marts:
finance:
+where: "date_column = current_date"
Apply where to a specific test:
tests:
my_project:
marts:
finance:
not_null_revenue_id:
+where: "date_column = current_date"
See the docs for resource-path for more info

Pass variable from Pre step to Build Step in Maven Jenkins Job

I have a maven job that runs a pom.xml file with some goals I provide like below:
Pom File: pom.xml
goals: test -DsuiteName=testng.xml
Now I want to add a radio button parameter into this job "Run_Failed_Cases_Only", if user selects this then instead of testng.xml I want to pass testng-failed.xml file. like below:
Pom File: pom.xml
goals: test -DsuiteName=testng-failed.xml
So what I want is if there is any way I can use windows batch command step, that will check if "Run_Failed_Cases_Only" is selected then pass a variable $goals to the build step as per the condition below:
if(Run_Failed_Cases_Only is selected)
$goals = "test -DsuiteName=testng-failed.xml"
else
$goals = test -DsuiteName=testng.xml
then I will use this variable in the goals text box.
When you have created the Maven Project job, select the option This project is parametrized from General tab. If the Extensible Choice Plugin is not installed, install it then you can find the same here in This project is parametrized
Please find the screenshot below.
Then, you can use the specific condition based on the choice parameter.
OR
Alternatively, You can also use Generator Choice parameter available in This project is parameterized to get the result.
Please find the screenshot.
Then, you can use the specific condition based on the choice.
Solved this by using Extended Choice Parameter and providing different display name and values like below:
then used this parameter as variable in POM like below:

Watson Knowledge studio, dictionary updation is not reflected in the current task

How to update dictionary in Watson Knowledge Studio and apply changes into the current task when already started human annotation.
I updated the dictionary(i.e. added few keywords required) and applied pre-annotation. The changes in dictionary were not updated in the annotation set in current task. Is there a way we can do it?
There is no way to apply dictionary update to existing tasks.
https://console.bluemix.net/docs/services/watson-knowledge-studio/annotate-documents.html#wks_hatask
You may be interested in the concordance tool to label multiple occurrences of a mention at once.
https://console.bluemix.net/docs/services/watson-knowledge-studio/user-guide.html#wks_haentity

Exclude specific files in Sonar's analyse

First my Sonarqube version is 4.5.2.
I want to exclude from analyze two files : fr.foo.foo1.MyClass1 and fr.foo.foo1.MyClass2, there is another classes in the foo1 package that I want still in the anlyse.
I try to set in the tab exclusions/files : exclude sources : **/fr/foo/foo1/MyClass1.java and **/fr/foo/foo1/MyClass2.java but the classes still in the analyse.
the only way I find to exclude the classes is to set the parameter to **/fr/foo/foo1/** but all the classes in the package are excluded or I want only the two classes MyClass1 and MyClass2.
The image below show how I set the exclusion in Sonar :
Any ideas ?
Thanks
Stef

Using Master Document for report generation in Enterprise Architect V11 - store configuration and filters

fellows!
I have a problem with report generation from my model using a Master Document defining a complex documentation. I believe some of you can help me solve the problem.
Facts:
I have a complex project consisting of several views and packages, inluding domain model, use case model, business process model, etc.
The model is stored in shared (database) repository along with other projects.
I have created custom templates, TOC, cover page and stylesheets for the documentation.
I have created a Master Document package with the main template assigned defining the main document I want to have generated.
I have created several Model Document elements in that package to define individual chapters of the document, assigning adequate templates and model packages to each of them.
I have successfully generated the desired documentation.
I am using Enterprise Architect version 11.0.1107
Problem 1:
I would like to have generated several variants of the same documentation. Thus, I need to change the settings of the generation process like the options, exclude filters and element filters.
However, the settings is not remembered after the generation and I have to set all the settings again when generating documentation on the Master Document package.
Is there a way to save the settings for the Master Document? I have found the Report Specification element, but it does not work as expected (see Problem 2).
Problem 2:
I have tried to use Report Specification element to save the settings for the report generation. I have created that element in the same package as the Master Document is located, and also inside of that Master Document package.
In both cases, when generating the documentation for the first time, EA asked me to select the package. I selected the Master Document package and confirmed the generation. However, the generated document is empty as it clearly does not take the Model Document elements in the selected package into account.
Did I use the Report Specification incorectly? Should I use another package for the Report Specification element? Should I select another package when using the Report Specification for report generation?
Problem 3:
I tried to apply element filters and some other options to include only some of the elements in the report. Let's say I want only element with the version 1.1. So I set the filters to "version = 1.1" when generating the report from the Master Document package.
However, the report contained all elements, regardless their version. The same happened when I tried to exclude anonymous elements. Furthermore, for the next try the filter settings was lost again and I had to set it again before next generation (see Problem 1).
Where should I configure the filters? Should it be set when generating using the Master Document package? Should it be set somewhere for the Model Document elements? Should it be set in the templates (thus making them very specific rather than general)? In such case, should it be set for the model template or for the individual fragments?
Summary:
If you have any tips for combination of Master Document and Report Specification, as well as using the element filters when generating from the Master Document, I would be very grateful.
We do'nt use Report Specification element, but we store specific options into Resource Document. Use [Resource Document] button on Generate Documentation dialog. This specification is stored between Resources (see Resources Window) under Document Generation -> Defined Documents.I hope this solves problem 1 and 2
Problem 3 - EA has more ways, how select elements for generation, unfortunatelly you can't combine them (as far as I know). I would try to define custom find filter and use it.

Resources