Skip to content

Commit

Permalink
Removing custom Optional
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Oct 8, 2018
1 parent da22c2d commit 8e0005f
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 219 deletions.
56 changes: 28 additions & 28 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Changelog of Violations lib.


## 1.69
### GitHub #46
### GitHub [#46](https://github.com/tomasbjerre/violations-lib/issues/46) Incomplete rule IDs in Flake8 parser *enhancement*

**Including entire rule in Flake8**

Expand Down Expand Up @@ -63,7 +63,7 @@ Changelog of Violations lib.


## 1.65
### GitHub #45
### GitHub [#45](https://github.com/tomasbjerre/violations-lib/issues/45) False positive matches in KotlinGradleParser *enhancement*

**Correcting Kotlin parsers**

Expand All @@ -72,7 +72,7 @@ Changelog of Violations lib.


## 1.64
### GitHub #44
### GitHub [#44](https://github.com/tomasbjerre/violations-lib/issues/44) Support kotlinc warnings *enhancement*

**Kotlin Maven and Gradle parsers**

Expand All @@ -90,7 +90,7 @@ Changelog of Violations lib.


## 1.62
### GitHub #42
### GitHub [#42](https://github.com/tomasbjerre/violations-lib/pull/42) Added yamllint parser

**Correcting YAMLLint**

Expand Down Expand Up @@ -145,7 +145,7 @@ Changelog of Violations lib.


## 1.59
### GitHub #39
### GitHub [#39](https://github.com/tomasbjerre/violations-lib/issues/39) AndroidLintParser doesn't expose rule correctly *enhancement*

**Adding category to model**

Expand All @@ -163,7 +163,7 @@ Changelog of Violations lib.


## 1.57
### GitHub #38
### GitHub [#38](https://github.com/tomasbjerre/violations-lib/issues/38) gcc, ARM-Gcc and Doxygen *enhancement*

**GCC, ARM GCC and Doxygen**

Expand Down Expand Up @@ -191,15 +191,15 @@ Changelog of Violations lib.


## 1.55
### GitHub #33
### GitHub [#33](https://github.com/tomasbjerre/violations-lib/issues/33) Add support for NullAway *enhancement*

**NullAway**


[72244241bbd2ead](https://github.com/tomasbjerre/violations-lib/commit/72244241bbd2ead) Tomas Bjerre *2018-04-14 05:08:26*


### GitHub #35
### GitHub [#35](https://github.com/tomasbjerre/violations-lib/issues/35) cpplint parser does not recognize any violations *bug*

**Testing cpplint variant**

Expand Down Expand Up @@ -251,7 +251,7 @@ Changelog of Violations lib.


## 1.52
### GitHub #10
### GitHub [#10](https://github.com/tomasbjerre/violations-lib/issues/10) Google error-prone *enhancement*

**Google error-prone**

Expand All @@ -260,7 +260,7 @@ Changelog of Violations lib.


## 1.51
### GitHub #30
### GitHub [#30](https://github.com/tomasbjerre/violations-lib/pull/30) Parameterize the max line length for the report table.

**Parameterize max width of reporter table**

Expand All @@ -269,7 +269,7 @@ Changelog of Violations lib.


## 1.50
### GitHub #28
### GitHub [#28](https://github.com/tomasbjerre/violations-lib/issues/28) Single quotes in xml are printed as '

**Un-escape XML when reading attributes.**

Expand Down Expand Up @@ -431,7 +431,7 @@ Changelog of Violations lib.


## 1.34
### GitHub #27
### GitHub [#27](https://github.com/tomasbjerre/violations-lib/issues/27) PMD may miss ruleSet and externalInfoUrl *bug*

**Accepting PMD files without ruleset-tag**

Expand Down Expand Up @@ -467,7 +467,7 @@ Changelog of Violations lib.


## 1.32
### GitHub #24
### GitHub [#24](https://github.com/tomasbjerre/violations-lib/pull/24) Added handling for empty IssueType Description attributes for Resharper

**Cleanup after merge**

Expand All @@ -489,7 +489,7 @@ Changelog of Violations lib.


## 1.31
### GitHub #23
### GitHub [#23](https://github.com/tomasbjerre/violations-lib/issues/23) Checkstyle: don't fail if rule attribute is not present

**Allowing absent source in Checkstyle parser**

Expand Down Expand Up @@ -522,23 +522,23 @@ Changelog of Violations lib.


## 1.28
### GitHub #19
### GitHub [#19](https://github.com/tomasbjerre/violations-lib/issues/19) Support detekt *enhancement*

**Updating doc about Detekt**


[bf5475d3e59fb3d](https://github.com/tomasbjerre/violations-lib/commit/bf5475d3e59fb3d) Tomas Bjerre *2017-06-13 18:14:41*


### GitHub #20
### GitHub [#20](https://github.com/tomasbjerre/violations-lib/issues/20) Support Facebook Infer *enhancement*

**Updating doc on Infer**


[22a2eb9add9884c](https://github.com/tomasbjerre/violations-lib/commit/22a2eb9add9884c) Tomas Bjerre *2017-06-23 12:44:57*


### GitHub #22
### GitHub [#22](https://github.com/tomasbjerre/violations-lib/pull/22) Renaming Reporter to Parser *enhancement*

**Renaming Reporter to Parser**

Expand Down Expand Up @@ -622,31 +622,31 @@ Changelog of Violations lib.


## 1.23
### GitHub #14
### GitHub [#14](https://github.com/tomasbjerre/violations-lib/issues/14) Support php checkers *enhancement*

**PHPMD and PHPCS**


[f7212555f7a986b](https://github.com/tomasbjerre/violations-lib/commit/f7212555f7a986b) Tomas Bjerre *2017-02-18 20:01:36*


### GitHub #15
### GitHub [#15](https://github.com/tomasbjerre/violations-lib/issues/15) Support Rubycop *enhancement*

**Support RubyCop**


[75ad3b3d415384a](https://github.com/tomasbjerre/violations-lib/commit/75ad3b3d415384a) Tomas Bjerre *2017-02-18 21:36:36*


### GitHub #16
### GitHub [#16](https://github.com/tomasbjerre/violations-lib/issues/16) Support clang *enhancement*

**Support CLang**


[68ac9c8cf268d17](https://github.com/tomasbjerre/violations-lib/commit/68ac9c8cf268d17) Tomas Bjerre *2017-02-18 21:28:31*


### GitHub #17
### GitHub [#17](https://github.com/tomasbjerre/violations-lib/issues/17) Support golint *enhancement*

**Support GoLint**

Expand All @@ -671,15 +671,15 @@ Changelog of Violations lib.


## 1.21
### GitHub #12
### GitHub [#12](https://github.com/tomasbjerre/violations-lib/issues/12) Support pydocstyle (old pep257) *enhancement*

**Adding MyPy and PyDocStyle parsers**


[acfe3312656237f](https://github.com/tomasbjerre/violations-lib/commit/acfe3312656237f) Tomas Bjerre *2017-02-06 17:07:33*


### GitHub #13
### GitHub [#13](https://github.com/tomasbjerre/violations-lib/issues/13) Support mypy *enhancement*

**Adding MyPy and PyDocStyle parsers**

Expand Down Expand Up @@ -790,7 +790,7 @@ Changelog of Violations lib.


## 1.13
### GitHub #11
### GitHub [#11](https://github.com/tomasbjerre/violations-lib/issues/11) CSSLint rollup output causes parsing error *bug*

**Handling css-lint reports where there are not line or evidence**

Expand Down Expand Up @@ -833,7 +833,7 @@ Changelog of Violations lib.


## 1.9
### GitHub #4
### GitHub [#4](https://github.com/tomasbjerre/violations-lib/issues/4) eslint *enhancement*

**ESLint**

Expand Down Expand Up @@ -900,15 +900,15 @@ Changelog of Violations lib.


## 1.6
### GitHub #5
### GitHub [#5](https://github.com/tomasbjerre/violations-lib/issues/5) PiTest *enhancement*

**Adding pitest parser**


[eeb2a624a99a7ff](https://github.com/tomasbjerre/violations-lib/commit/eeb2a624a99a7ff) Tomas Bjerre *2016-03-26 19:22:06*


### GitHub #7
### GitHub [#7](https://github.com/tomasbjerre/violations-lib/issues/7) Findbugs parser misses bugs *bug*

**Correcting exception message thrown if attribute not found**

Expand Down Expand Up @@ -936,7 +936,7 @@ Changelog of Violations lib.


## 1.5
### GitHub #3
### GitHub [#3](https://github.com/tomasbjerre/violations-lib/issues/3) Support more formats *enhancement*

**Support PerlCritic and XMLLint**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import se.bjurr.violations.lib.model.SEVERITY;
import se.bjurr.violations.lib.model.Violation;
import se.bjurr.violations.lib.util.Optional;

public class AndroidLintParser implements ViolationsParser {

Expand All @@ -40,8 +40,8 @@ public List<Violation> parseReportOutput(String string) throws Exception {
violations.add( //
violationBuilder() //
.setParser(ANDROIDLINT) //
.setStartLine(line.or(0)) //
.setColumn(charAttrib.orNull()) //
.setStartLine(line.orElse(0)) //
.setColumn(charAttrib.orElse(null)) //
.setFile(filename) //
.setSeverity(toSeverity(severity)) //
.setRule(id) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import se.bjurr.violations.lib.model.SEVERITY;
import se.bjurr.violations.lib.model.Violation;
import se.bjurr.violations.lib.util.Optional;

public class CSSLintParser implements ViolationsParser {

Expand All @@ -26,17 +26,17 @@ public List<Violation> parseReportOutput(String string) throws Exception {
String filename = getAttribute(fileChunk, "name");
List<String> issues = getChunks(fileChunk, "<issue", "/>");
for (String issueChunk : issues) {
Integer line = findIntegerAttribute(issueChunk, "line").or(1);
Integer line = findIntegerAttribute(issueChunk, "line").orElse(1);
Optional<Integer> charAttrib = findIntegerAttribute(issueChunk, "char");
String severity = getAttribute(issueChunk, "severity");

String message = getAttribute(issueChunk, "reason");
String evidence = findAttribute(issueChunk, "evidence").or("").trim();
String evidence = findAttribute(issueChunk, "evidence").orElse("").trim();
violations.add( //
violationBuilder() //
.setParser(CSSLINT) //
.setStartLine(line) //
.setColumn(charAttrib.orNull()) //
.setColumn(charAttrib.orElse(null)) //
.setFile(filename) //
.setSeverity(toSeverity(severity)) //
.setMessage(message + ": " + evidence) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import se.bjurr.violations.lib.model.SEVERITY;
import se.bjurr.violations.lib.model.Violation;
import se.bjurr.violations.lib.util.Optional;

public class CheckStyleParser implements ViolationsParser {

Expand All @@ -31,12 +31,12 @@ public List<Violation> parseReportOutput(String string) throws Exception {
final Optional<Integer> column = findIntegerAttribute(errorChunk, "column");
final String severity = getAttribute(errorChunk, "severity");
final String message = getAttribute(errorChunk, "message");
final String rule = findAttribute(errorChunk, "source").orNull();
final String rule = findAttribute(errorChunk, "source").orElse(null);
violations.add( //
violationBuilder() //
.setParser(CHECKSTYLE) //
.setStartLine(line) //
.setColumn(column.orNull()) //
.setColumn(column.orElse(null)) //
.setFile(filename) //
.setSeverity(toSeverity(severity)) //
.setMessage(message) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.logging.Logger;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import se.bjurr.violations.lib.model.SEVERITY;
import se.bjurr.violations.lib.model.Violation;
import se.bjurr.violations.lib.util.Optional;
import se.bjurr.violations.lib.util.Utils;

public class FindbugsParser implements ViolationsParser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.logging.Logger;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import se.bjurr.violations.lib.model.SEVERITY;
import se.bjurr.violations.lib.model.Violation;
import se.bjurr.violations.lib.util.Optional;
import se.bjurr.violations.lib.util.ViolationParserUtils;

public class FxCopParser implements ViolationsParser {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/bjurr/violations/lib/parsers/LintParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import se.bjurr.violations.lib.model.SEVERITY;
import se.bjurr.violations.lib.model.Violation;
import se.bjurr.violations.lib.util.Optional;

public class LintParser implements ViolationsParser {
@Override
Expand All @@ -35,7 +35,7 @@ public List<Violation> parseReportOutput(String string) throws Exception {
violationBuilder() //
.setParser(LINT) //
.setStartLine(line) //
.setColumn(charAttrib.orNull()) //
.setColumn(charAttrib.orElse(null)) //
.setFile(filename) //
.setSeverity(toSeverity(severity)) //
.setMessage(message + ": " + evidence) //
Expand Down
Loading

0 comments on commit 8e0005f

Please sign in to comment.