Showing 29 of 39 total issues
File GitConfigSource.java
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
package io.configrd.core.git;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
Method main
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String[] args) throws Throwable {
System.setProperty("org.jboss.logging.provider", "slf4j");
Options options = new Options();
GitRepoDef
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
@SuppressWarnings("serial")
public class GitRepoDef extends DefaultRepoDef
implements SecuredRepo, FileBasedRepo, GitCredentials {
public enum AuthMethod {
Method start
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected void start(Map<String, Object> initParama) throws Throwable {
if (GitStreamSource.GIT.equalsIgnoreCase((String) initParama.get(RepoDef.SOURCE_NAME_FIELD))
&& !initParama.containsKey(GitRepoDef.LOCAL_CLONE_FIELD)) {
initParama.put(GitRepoDef.LOCAL_CLONE_FIELD, DEFAULT_LOCAL_CLONE);
Method valid
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String[] valid() {
List<String> err = new ArrayList<>();
- 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 put
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean put(String path, PropertyPacket packet) {
long start = System.currentTimeMillis();
CannedAccessControlList acl = CannedAccessControlList.AuthenticatedRead;
Method gitPush
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean gitPush(RevCommit commit) {
boolean success = true;
RefSpec spec = null;
Consider simplifying this complex logical expression. Open
if (StringUtils.hasText(getAuthMethod())
&& (getAuthMethod().equals(AuthMethod.CodeCommitGitCreds.name())
|| getAuthMethod().equals(AuthMethod.CodeCommitIAMUser.name())
|| getAuthMethod().equals(AuthMethod.GitHub.name()))
&& (!StringUtils.hasText(getUsername()) || getUsername().trim().startsWith("${")
Method valid
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public String[] valid() {
List<String> err = new ArrayList<>();
Method setupCredentials
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void setupCredentials(String scheme, TransportCommand<? extends GitCommand, ?> command) {
if (getStreamSource().getSourceConfig().getAuthMethod() != null
&& (scheme == null || (!scheme.toLowerCase().startsWith("http")
&& !scheme.toLowerCase().startsWith("git:")))) {
Method write
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private String write(PropertyPacket packet) {
final URI uri = toURI(packet);
String content = null;
Method gitPush
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private boolean gitPush(RevCommit commit) {
boolean success = true;
RefSpec spec = null;
- 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 newConfigSource
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public GitConfigSource newConfigSource(String name, Map<String, Object> values) {
GitRepoDef def = new GitRepoDef(name, values);
Method newConfigSource
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public GitConfigSource newConfigSource(String name, Map<String, Object> values) {
GitRepoDef def = new GitRepoDef(name, values);
- 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 init_repos
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected void init_repos(Map<String, Object> initParama) throws Exception {
String path = (String) initParama.get(RepoDef.URI_FIELD);
URI uri = URI.create(ConfigSourceResolver.DEFAULT_CONFIG_URI);
- 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 start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected void start(Map<String, Object> initParama) throws Throwable {
if (GitStreamSource.GIT.equalsIgnoreCase((String) initParama.get(RepoDef.SOURCE_NAME_FIELD))
&& !initParama.containsKey(GitRepoDef.LOCAL_CLONE_FIELD)) {
initParama.put(GitRepoDef.LOCAL_CLONE_FIELD, DEFAULT_LOCAL_CLONE);
- 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 setupCredentials
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private void setupCredentials(String scheme, TransportCommand<? extends GitCommand, ?> command) {
if (getStreamSource().getSourceConfig().getAuthMethod() != null
&& (scheme == null || (!scheme.toLowerCase().startsWith("http")
&& !scheme.toLowerCase().startsWith("git:")))) {
- 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 sign
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static byte[] sign(String key, String dateStamp, String regionName, String serviceName,
String toSign)
Method compilePatterns
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected Pattern compilePatterns(Map<String, Object> vals, final String key) {
Pattern dest = Pattern.compile("a^");
if (vals.get(key.toLowerCase()) != null) {
- 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 putTextProperties
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Response putTextProperties(String repo, String path, String eTag, InputStream body)
throws Exception {
Response resp = Response.serverError().build();
- 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"