Skip to content

Commit

Permalink
Removing Guava dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Dec 14, 2016
1 parent 5d94e7f commit 0b8af64
Show file tree
Hide file tree
Showing 39 changed files with 568 additions and 369 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.okhttpcache
.classpath
.project
.settings
Expand Down
26 changes: 20 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ Changelog of Git Changelog.
## Unreleased
### No issue

**Removing Guava dependency**


[a4d55312f0a3481](https://github.com/tomasbjerre/git-changelog-lib/commit/a4d55312f0a3481) Tomas Bjerre *2016-12-14 17:40:28*

**doc**


[5d94e7f3626a273](https://github.com/tomasbjerre/git-changelog-lib/commit/5d94e7f3626a273) Tomas Bjerre *2016-11-06 18:12:13*


## 1.16
### No issue

**Simian, ZPTLint, JCReport**


[3128473c31455e8](https://github.com/tomasbjerre/git-changelog-lib/commit/3128473c31455e8) Tomas Bjerre *2016-11-05 22:38:58*
[60fa8a9b6091ddd](https://github.com/tomasbjerre/git-changelog-lib/commit/60fa8a9b6091ddd) Tomas Bjerre *2016-11-05 22:39:23*

**Gendarme**

Expand Down Expand Up @@ -45,7 +59,7 @@ Changelog of Git Changelog.


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

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

Expand Down Expand Up @@ -88,7 +102,7 @@ Changelog of Git Changelog.


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

**ESLint**

Expand Down Expand Up @@ -155,15 +169,15 @@ Changelog of Git Changelog.


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

**Adding pitest parser**


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


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

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

Expand Down Expand Up @@ -191,7 +205,7 @@ Changelog of Git Changelog.


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

**Support PerlCritic and XMLLint**

Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ apply plugin: 'net.researchgate.release'
apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin"

task gitChangelogTask(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
gitHubApi = "https://api.github.com/repos/tomasbjerre/violations-lib";
gitHubToken = System.properties['GITHUB_OAUTH2TOKEN'];
gitHubIssuePattern = "#([0-9]*)";
filePath = "CHANGELOG.md";
templateContent = new File('changelog.mustache').getText('UTF-8');
removeIssueFromMessage = true
customIssues = [
[ "GitHub", "#([0-9]+)", "https://github.com/tomasbjerre/violations-lib/issues/\${PATTERN_GROUP_1}" ]
]
}

group = 'se.bjurr.violations'
Expand All @@ -40,7 +40,6 @@ repositories {
}

dependencies {
compile 'com.google.guava:guava:11.0.1'
compile 'org.slf4j:slf4j-api:1.7.18'
testCompile 'org.slf4j:slf4j-simple:1.7.18'
testCompile 'junit:junit:4.12'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,51 @@
package se.bjurr.violations.lib;

import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Ordering.from;
import static se.bjurr.violations.lib.model.SEVERITY.INFO;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import se.bjurr.violations.lib.model.SEVERITY;
import se.bjurr.violations.lib.model.Violation;

import com.google.common.base.Predicate;

public class ViolationsAccumulatedReporterApi {

private final List<Violation> violations = newArrayList();
public static ViolationsAccumulatedReporterApi violationsAccumulatedReporterApi() {
return new ViolationsAccumulatedReporterApi();
}

private SEVERITY atLeastSeverity = INFO;
private ORDERED_BY orderedBy;

private final List<Violation> violations = new ArrayList<>();

private ViolationsAccumulatedReporterApi() {
}

public ViolationsAccumulatedReporterApi withViolationsReporterApiList(List<Violation> violations) {
this.violations.addAll(violations);
public ViolationsAccumulatedReporterApi orderedBy(ORDERED_BY orderedBy) {
this.orderedBy = orderedBy;
return this;
}

public static ViolationsAccumulatedReporterApi violationsAccumulatedReporterApi() {
return new ViolationsAccumulatedReporterApi();
public List<Violation> violations() {
List<Violation> sorted = new ArrayList<>();
for (Violation violation : violations) {
if (violation.getSeverity().ordinal() >= atLeastSeverity.ordinal()) {
sorted.add(violation);
}
}
Collections.sort(sorted, orderedBy.getComparator());
return sorted;
}

public ViolationsAccumulatedReporterApi withAtLeastSeverity(SEVERITY atLeastSeverity) {
this.atLeastSeverity = atLeastSeverity;
return this;
}

public ViolationsAccumulatedReporterApi orderedBy(ORDERED_BY orderedBy) {
this.orderedBy = orderedBy;
public ViolationsAccumulatedReporterApi withViolationsReporterApiList(List<Violation> violations) {
this.violations.addAll(violations);
return this;
}

public List<Violation> violations() {
return from(orderedBy.getComparator())//
.sortedCopy(//
filter(violations, new Predicate<Violation>() {
@Override
public boolean apply(Violation input) {
return input.getSeverity().ordinal() >= atLeastSeverity.ordinal();
}
}));
}
}
Loading

0 comments on commit 0b8af64

Please sign in to comment.