Showing 19 of 68 total issues
File JGitRepository.java
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* This code is free software; you can redistribute it and/or modify it under
* the terms of the new BSD License.
*
* Copyright (c) 2012-2020, Sebastian Staudt
JGitRepository
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
public class JGitRepository extends AbstractGitRepository {
static final String COMMONDIR_FILE = "commondir";
static final Pattern DESCRIBE_PATTERN = Pattern.compile("(.*)-([1-9][0-9]*)-g([0-9a-f]+)$");
static final String GITDIR_FILE = "gitdir";
Method buildRepository
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
final void buildRepository(File workTree, File gitDir) throws GitRepositoryException {
if (gitDir == null && workTree == null) {
throw new GitRepositoryException("Neither worktree nor GIT_DIR is set.");
} else {
if (workTree != null && !workTree.exists()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parseMailMap
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
void parseMailMap(File mailMap) throws IOException {
try (BufferedReader mailMapReader = new BufferedReader(new FileReader(mailMap))) {
String line;
while ((line = mailMapReader.readLine()) != null) {
line = line.trim();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parseMailMap
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
void parseMailMap(File mailMap) throws IOException {
try (BufferedReader mailMapReader = new BufferedReader(new FileReader(mailMap))) {
String line;
while ((line = mailMapReader.readLine()) != null) {
line = line.trim();
Method run
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void run(GitRepository repository) throws MavanagaiataMojoException {
try {
GitCommit commit = repository.getHeadCommit();
String abbrevId = repository.getAbbreviatedCommitId();
String shaId = commit.getId();
Method writeOutput
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void writeOutput(GitRepository repository)
throws MavanagaiataMojoException {
try {
mailMap = repository.getMailMap();
Method printCompareLink
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
void printCompareLink(String currentRef, String lastRef, boolean isBranch) {
if (baseUrl == null) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected void run() throws GitRepositoryException {
if (skipCommitsPattern != null && skipCommitsPattern.matcher(currentCommit.getMessage()).find()) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method resolveLinkedWorkTree
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private void resolveLinkedWorkTree(File workTree, File foundGitDir, FileRepositoryBuilder repositoryBuilder) throws IOException {
if (directoryContains(foundGitDir.getParentFile(), workTree)) {
repositoryBuilder.setGitDir(foundGitDir);
repositoryBuilder.setWorkTree(foundGitDir.getParentFile());
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method describe
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public GitTagDescription describe() throws GitRepositoryException {
DescribeCommand command = getDescribeCommand();
try {
Method getValueSource
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
MapBasedValueSource getValueSource(GitRepository repository)
throws GitRepositoryException {
GitTagDescription description = repository.describe();
String abbrevId = repository.getAbbreviatedCommitId();
Method initConfiguration
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void initConfiguration() {
super.initConfiguration();
format = formatTemplate.getFormat().apply(format);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method writeOutput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void writeOutput(GitRepository repository)
throws MavanagaiataMojoException {
try {
mailMap = repository.getMailMap();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method describe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public GitTagDescription describe() throws GitRepositoryException {
DescribeCommand command = getDescribeCommand();
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getTags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Map<String, GitTag> getTags()
throws GitRepositoryException {
Map<String, GitTag> tags = new HashMap<>();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method checkTag
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private void checkTag(GitRepository repository)
throws GitRepositoryException, CheckMojoException {
if (checkTag) {
if (!repository.describe().isTagged()) {
throw new CheckMojoException(CheckMojoException.Type.UNTAGGED);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected final void run(GitRepository repository) throws MavanagaiataMojoException {
if (getOutputFile() == null) {
printStream = System.out;
generateOutput(repository);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public final void execute()
throws MojoExecutionException, MojoFailureException {
if (skip) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"