-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement AxivionSuite tool which queries the Axivion Dashboard for violations #20
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
===========================================
- Coverage 80.83% 79.4% -1.43%
- Complexity 1371 1393 +22
===========================================
Files 225 231 +6
Lines 4685 4967 +282
Branches 375 394 +19
===========================================
+ Hits 3787 3944 +157
- Misses 744 864 +120
- Partials 154 159 +5
Continue to review full report at Codecov.
|
import net.sf.json.JSONArray; | ||
import net.sf.json.JSONObject; | ||
|
||
public class AxivionParser extends IssueParser implements Serializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you implement IssueParser
?
private String credentialsId = StringUtils.EMPTY; | ||
private String basedir = "$"; | ||
|
||
public AxivionSuite(final String projectUrl, final String credentialsId, final String basedir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package private and @VisibleForTesting
|
||
public AxivionSuite(final String projectUrl, final String credentialsId, final String basedir) { | ||
super(); | ||
// empty constructor required for stapler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
return new AxivionParser(projectUrl, | ||
withValidateCredentials(), | ||
expandBaseDir(run, this.basedir) | ||
).parse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
not required if parser does not implement interface.
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.http.auth.UsernamePasswordCredentials; | ||
|
||
import com.cloudbees.plugins.credentials.CredentialsMatchers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this dependency coming from? Jenkins-core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes from the Credentials Plugin
which is shipped by Jenkins and can't be deinstalled.
public class AxivionSuite extends Tool { | ||
|
||
private static final long serialVersionUID = 8670135727302169818L; | ||
static final String ID = "AxivionStoppingSoftwareErosion"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quite a long URL, is this intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it was intented, but AxivionSuite is ok too. Changed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used as URL to the results, so typically it does contain only lowercase characters (separated by -), see https://github.com/jenkinsci/warnings-ng-plugin/blob/master/SUPPORTED-FORMATS.md.
assertTrue(ArrayUtils.contains(expected, actual.getType())); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more tests would be helpful.
}; | ||
for (final Issue actual : report) { | ||
assertTrue(ArrayUtils.contains(expected, actual.getType())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check all properties of an issue
final String payload = new String(new Resource(svJson).asByteArray()); | ||
|
||
Report report = new Report(); | ||
parser.processIssues( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you test the parse()
method?
…nd traversal logic
Thanks for the review, I incorporated your comments. What is the right way to integrate jelly templating? I can't reproduce the architecture violations locally. Is |
See https://github.com/jenkinsci/warnings-ng-plugin/pull/20/files#r268879821
The architecture violations are from a simple unit test, why does it not work locally? I'm currently preparing the project to be used in my testing course here at the university, so I want that everybody conforms to my guidelines. I hope they are not too academic;-) Two new rules that are now enforced with an architecture test: I generally want to forbid direct
No, I simply want to use only one assertion framework in my modules and that is AssertJ. Otherwise contributors get confused if some use JUnit4, some use JUnit5, some AssertJ, etc. |
src/main/resources/io/jenkins/plugins/analysis/warnings/axivion/local-config.jelly
Outdated
Show resolved
Hide resolved
Thanks for the input, Just the "document all public members" I would call too academic as I remember this requirement from my studies in Bremen ;). |
Seems that your tests (or your code;-) do not work correctly on Windows: |
587019e
to
f7d1d21
Compare
Thanks! |
No description provided.