Skip to content
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

handle cargo check case where no code is present #502

Merged
merged 2 commits into from Aug 28, 2020

Conversation

thefarwind
Copy link
Contributor

@thefarwind thefarwind commented Aug 28, 2020

cargo-check.log
When using the cargo tool in the warnings next generation plugin configured as follows:

steps {
  sh 'cargo check --message-format json > cargo-check.log'
}
post {
  always {
    recordIssues tool: cargo(pattern: 'cargo-check.log')
  }
}

I was receiving the following error message:

JSONObject["code"] is not a JSONObject.

I tracked this crash to "warning: 1 warning emitted" line from the cargo check output, which instead of having an error code, has a null error code.

This change modified the cargo check parser to ignore compiler-messages which have a null code field. It also added an appropriate test message to verify compiler-messages with a null code are ignored, as well as two additional test messages of additional message types which appeared in the cargo-check output.

image

@codecov
Copy link

codecov bot commented Aug 28, 2020

Codecov Report

Merging #502 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #502   +/-   ##
=========================================
  Coverage     90.27%   90.27%           
- Complexity     1517     1518    +1     
=========================================
  Files           171      171           
  Lines          4513     4515    +2     
  Branches        491      492    +1     
=========================================
+ Hits           4074     4076    +2     
  Misses          284      284           
  Partials        155      155           
Impacted Files Coverage Δ Complexity Δ
...du/hm/hafner/analysis/parser/CargoCheckParser.java 100.00% <100.00%> (ø) 10.00 <0.00> (+1.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afe7a9c...76da303. Read the comment docs.

@uhafner uhafner merged commit 49ab4ee into jenkinsci:master Aug 28, 2020
@uhafner
Copy link
Member

uhafner commented Aug 28, 2020

Thanks for fixing!

@uhafner uhafner added the bug Bugs or performance problems label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs or performance problems
Projects
None yet
2 participants