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

Added teams functionality #380

Merged
merged 109 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
d08d4ca
add use-cases, services, ports for managing teams
maximAtanasov May 5, 2020
8bbff09
create controllers for team configuration
KilianKrause May 5, 2020
528d064
implemented services for team management
maximAtanasov May 5, 2020
99f5f74
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov May 5, 2020
2bd9cf5
implement AddUsersToTeamController
KilianKrause May 5, 2020
5a34eed
add create and delete team use-cases/ports/service
maximAtanasov May 5, 2020
f7ea11d
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
KilianKrause May 5, 2020
f44bb38
Implemented:
maximAtanasov May 5, 2020
f9cb589
implement controllers for teams/users configuration
KilianKrause May 5, 2020
877268a
apply spotless
KilianKrause May 5, 2020
3b26fd1
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
KilianKrause May 5, 2020
a52b8ad
create adapters
KilianKrause May 6, 2020
3336421
work on useradministration adapters
maximAtanasov May 6, 2020
d800d30
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov May 6, 2020
08905ea
implement useradministration adapters
maximAtanasov May 6, 2020
cc322c1
adjust controllers
KilianKrause May 6, 2020
9e5bcb1
fix CreateTeamService
maximAtanasov May 6, 2020
d545907
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov May 6, 2020
672d95e
fix queries
maximAtanasov May 6, 2020
e7511b0
fix typo in ProjectRepository
maximAtanasov May 6, 2020
162b37d
added ListTeams use-case/port/controller/adapter
maximAtanasov May 6, 2020
3dc9487
create json wrapper for ProjectRole
KilianKrause May 6, 2020
dbcb0b1
do not create multiple relationships between teams and projects
maximAtanasov May 6, 2020
89df620
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov May 6, 2020
e7dc5de
minor fixes
KilianKrause May 6, 2020
b8a35a4
add ListUsersForProject use-case/port/adapter/service/controller and …
maximAtanasov May 6, 2020
751c65e
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov May 6, 2020
f7c91f1
fix the addUsersToTeam Query in TeamRepository
maximAtanasov May 6, 2020
70d38a8
rename DeleteUserRoleForProject* to RemoveUserFromProject* and implem…
maximAtanasov May 6, 2020
411b234
change method parameter of controller
KilianKrause May 6, 2020
6a7144b
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
KilianKrause May 6, 2020
729584f
some fixes
KilianKrause May 6, 2020
149414e
add mapper for response classes in the rest module
KilianKrause May 6, 2020
2883093
wrote controller tests for the new controllers and adjusted some of t…
maximAtanasov May 6, 2020
0268005
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov May 6, 2020
2d08714
Merge branch 'master' of https://github.com/adessoAG/coderadar into t…
maximAtanasov May 6, 2020
d594664
add team-service.ts, user.ts, project-role.ts, team.ts and rename Del…
maximAtanasov May 6, 2020
b831991
wrote response mapper tests
maximAtanasov May 7, 2020
363611f
Write graph mapper tests
maximAtanasov May 7, 2020
cce780d
implement mapper for GetFilePatternResponse and GetModuleResponse
KilianKrause Jun 3, 2020
facdda2
make sure that controllers consume and produce JSON values where nece…
KilianKrause Jun 3, 2020
e0223e3
fix a few SonarCloud issues
maximAtanasov Jun 4, 2020
2937f3c
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov Jun 4, 2020
dfc97c0
spotless
maximAtanasov Jun 4, 2020
d8c2573
add tests for rest controller response mappers
maximAtanasov Jun 8, 2020
84aa566
change the way get requests are passed to the front-end so as to not …
maximAtanasov Jun 10, 2020
c1e0623
wrote base integration tests for the teams/users controllers (only po…
maximAtanasov Jun 10, 2020
37ffcd6
added asciidocs for the new endpoints
maximAtanasov Jun 12, 2020
241a421
added a sidenav in the main dashboard and a teams dashboard page
maximAtanasov Jun 12, 2020
3a23931
fix bug that caused commits not to be returned for certain emails
maximAtanasov Jun 12, 2020
f128dfc
apply spotless
maximAtanasov Jun 12, 2020
3a0e3a2
added an add-team page
maximAtanasov Jun 12, 2020
1b38183
set admin role when creating a project. Project dashboard only displa…
maximAtanasov Jun 15, 2020
b61bf84
add back-end authentication
maximAtanasov Jun 16, 2020
fc609fb
Merge branch 'master' of https://github.com/adessoAG/coderadar into t…
maximAtanasov Jun 16, 2020
f509841
fix sonarcloud code smells
maximAtanasov Jun 16, 2020
597ea4e
fix sonarcloud code smells
maximAtanasov Jun 17, 2020
0d92dbf
attempt adding code coverage report for sonarcloud
maximAtanasov Jun 17, 2020
1b34377
attempt adding code coverage report for sonarcloud
maximAtanasov Jun 17, 2020
545da0a
attempt adding code coverage report for sonarcloud
maximAtanasov Jun 17, 2020
d3d85db
attempt adding code coverage report for sonarcloud
maximAtanasov Jun 17, 2020
a23ca3b
attempt adding code coverage report for sonarcloud
maximAtanasov Jun 17, 2020
51a4930
add ProjectRoleValidator for validating the ProjectRole enum
KilianKrause Jun 17, 2020
59e4d3c
spotless
KilianKrause Jun 17, 2020
a89b34f
fix sonarqube code coverage
maximAtanasov Jul 3, 2020
ef80474
Merge branch 'master' into teams
maximAtanasov Jul 3, 2020
6e59a31
Update sonarcloud.yml
maximAtanasov Jul 3, 2020
100b6da
fix a bug that caused deleted projects to show up
maximAtanasov Jul 3, 2020
48dde8c
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov Jul 3, 2020
c20d8d3
update checkstyle to 8.0
maximAtanasov Jul 6, 2020
ac6f855
remove ProjectRoleValidator
KilianKrause Jul 6, 2020
6227d6b
use only one tempDir for checkstyle and remove unnecessary database q…
maximAtanasov Jul 6, 2020
839c67d
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov Jul 6, 2020
6675d8b
remove unused moduleRepository field
maximAtanasov Jul 6, 2020
d42b1c5
Merge branch 'master' into teams
maximAtanasov Jul 6, 2020
ec62bb9
show when a file was deleted in the file browser
maximAtanasov Jul 6, 2020
aebad95
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov Jul 6, 2020
b36d3c1
Update ContributorQueryRepository.java
maximAtanasov Jul 6, 2020
d403445
apply review changes
maximAtanasov Jul 10, 2020
bcda8b3
Merge branch 'master' into teams
maximAtanasov Jul 10, 2020
ce91fba
Deleted TODOs in main-dashboard.componenet.ts
maximAtanasov Jul 15, 2020
b03c5f8
Merge branch 'master' into teams
maximAtanasov Jul 17, 2020
91a16ae
Merge branch 'master' into teams
maximAtanasov Jul 19, 2020
ea2ec49
add static import for MockMvcResultMatchers.status()
KilianKrause Jul 22, 2020
dceb6d7
Merge branch 'master' of https://github.com/adessoAG/coderadar into t…
maximAtanasov Jul 24, 2020
31d60f7
apply review changes
maximAtanasov Jul 24, 2020
f1d79aa
spotless
maximAtanasov Jul 24, 2020
e2643c5
change FilePatterns to FilePattern in file-patterns.spec.ts
maximAtanasov Jul 24, 2020
073caf4
add negative tests
KilianKrause Jul 24, 2020
c38dce6
apply spotless
KilianKrause Jul 24, 2020
56c817c
Merge branch 'master' of https://github.com/adessoAG/coderadar into t…
KilianKrause Jul 27, 2020
1bd5683
add some more negative tests
KilianKrause Jul 27, 2020
70e6a7c
minor fixes
maximAtanasov Jul 28, 2020
fcb23e1
Merge branch 'master' of https://github.com/adessoAG/coderadar into a…
KilianKrause Jul 31, 2020
5b645e1
Merge branch 'teams' of https://github.com/adessoAG/coderadar into ad…
KilianKrause Jul 31, 2020
4715ec5
Merge branch 'master' of https://github.com/adessoAG/coderadar into t…
maximAtanasov Jul 31, 2020
38648d2
fix tslint errors and typos
KilianKrause Aug 6, 2020
f7f378e
Merge branch 'master' into teams
maximAtanasov Aug 6, 2020
dc2b28f
Merge branch 'master' into teams
maximAtanasov Aug 6, 2020
6e802f4
Merge branch 'teams' of https://github.com/adessoAG/coderadar into ad…
KilianKrause Aug 6, 2020
c0790b6
Merge pull request #400 from adessoAG/add-negative-tests
maximAtanasov Aug 7, 2020
7cf85aa
add tests for the AuthenticationService
maximAtanasov Aug 7, 2020
cf75d44
Merge branch 'master' into teams
maximAtanasov Aug 7, 2020
6e69300
fix code smells
maximAtanasov Aug 7, 2020
1f6d26c
Merge branch 'teams' of https://github.com/adessoAG/coderadar into teams
maximAtanasov Aug 7, 2020
0f5578b
apply tslint
maximAtanasov Aug 7, 2020
c4b5804
Merge branch 'master' into teams
maximAtanasov Aug 11, 2020
9d65cc9
Merge branch 'master' into teams
maximAtanasov Sep 2, 2020
b586771
throw an exception if a user is not assigned to a project when trying…
maximAtanasov Sep 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: analyze on sonarcloud
run: gradle build sonarqube -Dsonar.login=${{ secrets.SONAR_TOKEN }}
run: gradle codeCoverageReport sonarqube -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.java.binaries=build/classes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91 changes: 81 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
Expand All @@ -10,9 +11,13 @@ buildscript {

plugins {
id "org.sonarqube" version "2.8"
id "jacoco"
}

apply plugin: 'idea'
apply plugin: "jacoco"
apply plugin: "java"
apply plugin: "org.sonarqube"

ext {
majorVersion = '0'
Expand All @@ -28,20 +33,11 @@ file('gradle.d').listFiles().sort().each {
}
}

sonarqube {
properties {
property "sonar.projectKey", "adessoAG_coderadar"
property "sonar.organization", "adesso-ag"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.sources", "src/main/java, coderadar-ui/src"
property "sonar.tests", "src/test/java"
property "sonar.exclusions", "coderadar-app/workdir"
}
}

subprojects {
apply plugin: "idea"
apply plugin: "java"
apply plugin: "org.sonarqube"

buildscript {
repositories {
Expand Down Expand Up @@ -79,6 +75,19 @@ subprojects {
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport
}

jacocoTestReport {
dependsOn test
}

jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
}
}

dependencies {
Expand All @@ -87,12 +96,74 @@ subprojects {
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: version_junit
annotationProcessor("org.projectlombok:lombok:$lombok_version")
compileOnly("org.projectlombok:lombok:$lombok_version")
testCompile group: 'org.jacoco', name: 'org.jacoco.ant', version: '0.8.5'
}


}

idea {
project {
vcs = 'Git'
}
}

sonarqube {
properties {
property "sonar.projectKey", "adessoAG_coderadar"
property "sonar.organization", "adesso-ag"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.sources", "src/main/java, coderadar-ui/src"
property "sonar.tests", "src/test/java"
property "sonar.exclusions", "coderadar-app/workdir"
property 'sonar.core.codeCoveragePlugin', 'jacoco'
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/codeCoverageReport/codeCoverageReport.xml"
}
}

allprojects {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
testCompile group: 'org.jacoco', name: 'org.jacoco.ant', version: '0.8.5'
}
}

tasks.register("codeCoverageReport", JacocoReport) {
// If a subproject applies the 'jacoco' plugin, add the result it to the report
subprojects { subproject ->
subproject.plugins.withType(JacocoPlugin).configureEach {
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask ->
sourceSets subproject.sourceSets.main
executionData(testTask)
}

// To automatically run `test` every time `./gradlew codeCoverageReport` is called,
// you may want to set up a task dependency between them as shown below.
// Note that this requires the `test` tasks to be resolved eagerly (see `forEach`) which
// may have a negative effect on the configuration time of your build.
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).forEach {
rootProject.tasks.codeCoverageReport.dependsOn(it)
}
}
}

// enable the different report types (html, xml, csv)
reports {
// xml is usually used to integrate code coverage with
// other tools like SonarQube, Coveralls or Codecov
xml.enabled true

// HTML reports can be used to see code coverage
// without any external tools
html.enabled true
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;

@EnableScheduling
@EnableAsync(proxyTargetClass = true)
Expand All @@ -19,22 +18,15 @@
@EntityScan(basePackages = "io.reflectoring.coderadar")
@SpringBootApplication(scanBasePackages = "io.reflectoring.coderadar")
@Controller
public class CoderadarApplication implements ErrorController {
public class CoderadarApplication {

public static void main(String[] args) {
Locale.setDefault(Locale.US);
SpringApplication.run(CoderadarApplication.class, args);
}

// Forward unknown paths to index.html (angular)
private static final String PATH = "/error";

@RequestMapping(path = PATH)
public String error() {
@GetMapping(value = "/**/{path:[^.]*}")
public String redirect() {
return "forward:/index.html";
}

@Override
public String getErrorPath() {
return PATH;
}
}

This file was deleted.

1 change: 1 addition & 0 deletions coderadar-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.diffplug.gradle.spotless"
apply plugin: "jacoco"

dependencies {
compile project(':coderadar-plugin-api')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static class Authentication {

@NotNull private Integer accessTokenDurationInMinutes = 15;

@NotNull private Boolean enabled = Boolean.TRUE;
private boolean enabled = Boolean.TRUE;

@NotNull private Integer refreshTokenDurationInMinutes = 86400;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

@Service
public class AnalyzerPluginService {
private Logger logger = LoggerFactory.getLogger(AnalyzerPluginService.class);
private final Logger logger = LoggerFactory.getLogger(AnalyzerPluginService.class);

private Map<String, Class<? extends SourceCodeFileAnalyzerPlugin>> sourceCodeFileAnalyzerPlugins =
new HashMap<>();
private final Map<String, Class<? extends SourceCodeFileAnalyzerPlugin>>
sourceCodeFileAnalyzerPlugins = new HashMap<>();

/**
* Constructs a new AnalyzerPluginRegistry. This is a very expensive operation since the
Expand Down Expand Up @@ -103,7 +103,7 @@ private void checkValidConfigurationFile(
}
throw new IllegalArgumentException(
String.format(
"Not a valid configuration file for analyzer plugin %s. The first couple lines of configuration file are:\n %s",
"Not a valid configuration file for analyzer plugin %s. The first couple lines of configuration file are:%n %s",
configurableAnalyzer.getClass(), firstCoupleLines.toString()));
} catch (IOException e) {
throw new IllegalArgumentException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,44 +170,42 @@ private void analyzeBranch(
*/
private void zeroOutMissingMetrics(
Commit commit, List<MetricValue> metrics, Map<Long, List<MetricValue>> fileMetrics) {

for (FileToCommitRelationship relationship : commit.getTouchedFiles()) {
List<MetricValue> values = fileMetrics.get(relationship.getFile().getId());
if (values != null) {
for (MetricValue value : values) {
if (value.getValue() != 0
&& metrics.stream()
.noneMatch(
metricValue ->
metricValue.getName().equals(value.getName())
&& metricValue.getFileId() == value.getFileId())) {
metrics.add(
new MetricValue(
value.getName(),
0L,
commit.getId(),
value.getFileId(),
Collections.emptyList()));
}
List<MetricValue> values =
fileMetrics.getOrDefault(relationship.getFile().getId(), Collections.emptyList());

for (MetricValue value : values) {
if (value.getValue() != 0
&& metrics.stream()
.noneMatch(
metricValue ->
metricValue.getName().equals(value.getName())
&& metricValue.getFileId() == value.getFileId())) {
metrics.add(
new MetricValue(
value.getName(), 0L, commit.getId(), value.getFileId(), Collections.emptyList()));
}
}
}

if (metrics.isEmpty()) {
return;
}
metrics.sort(Comparator.comparingLong(MetricValue::getFileId));
if (!metrics.isEmpty()) {
long fileId = metrics.get(0).getFileId();
List<MetricValue> metricsForFile = new ArrayList<>();
for (MetricValue metricValue : metrics) {
if (metricValue.getValue() != 0) {
if (metricValue.getFileId() != fileId) {
fileMetrics.put(fileId, new ArrayList<>(metricsForFile));
fileId = metricValue.getFileId();
metricsForFile.clear();
}
metricsForFile.add(metricValue);
long fileId = metrics.get(0).getFileId();
List<MetricValue> metricsForFile = new ArrayList<>();
for (MetricValue metricValue : metrics) {
if (metricValue.getValue() != 0) {
if (metricValue.getFileId() != fileId) {
fileMetrics.put(fileId, new ArrayList<>(metricsForFile));
fileId = metricValue.getFileId();
metricsForFile.clear();
}
metricsForFile.add(metricValue);
}
fileMetrics.put(fileId, metricsForFile);
}
fileMetrics.put(fileId, metricsForFile);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import java.util.Set;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class Contributor {
private Long id;
private String displayName;
Expand Down
Loading