mtrevisan/HunLinter

View on GitHub

Showing 197 of 403 total issues

Method extractOwnCodeStackTrace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static StackTraceElement extractOwnCodeStackTrace(final Throwable t){
        final StackTraceElement[] stackTrace = t.getStackTrace();
        StackTraceElement stackTrace0 = null;
        if(stackTrace.length > 0){
            final String className = ExceptionHelper.class.getName();

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 processLinesSequentialByLine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("OverlyBroadThrowsClause")
    private void processLinesSequentialByLine(final Path path, final Charset charset, final Consumer<IndexDataPair<String>> dataProcessor)
            throws IOException{
        //read entire file in memory
        final List<String> lines = FileHelper.readAllLines(path, charset);

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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        @Override
        public Boolean call(){
            try{
                final Object subscriber = handlerInfo.getSubscriber();
                if(subscriber == null){

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 classifyCasing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static Casing classifyCasing(final CharSequence text){
        if(StringUtils.isBlank(text))
            return Casing.LOWER_CASE;

        final long upper = text.chars()

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 mergeSort has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static void mergeSort(final Queue<BinaryFileBuffer> queue, final boolean removeDuplicates, final BufferedWriter writer,
            final String lineSeparator) throws IOException{
        String lastLine = null;
        while(!queue.isEmpty()){
            final BinaryFileBuffer buffer = queue.poll();

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 dispatchToVetoableHandlers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        private boolean dispatchToVetoableHandlers(final Object evt, final Collection<HandlerInfoCallable> vetoHandlers){
            //used to keep track if a veto was called (if so, the regular list won't be processed)
            boolean vetoCalled = false;

            //submit the veto calls to the executor service

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 extractInflection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static void extractInflection(final List<String> suffixInflection, final ByteBuffer output){
        if(suffixInflection != null)
            for(int i = 0; i < suffixInflection.size(); i ++){
                final String[] tags = InflectionTag.createFromCodeAndValue(suffixInflection.get(i)).getTags();
                for(int j = 0; j < tags.length; j ++)

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 matchesAny has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static boolean matchesAny(final Path input, final Iterable<PathMatcher> patterns){
        if(patterns != null)
            for(final PathMatcher pattern : patterns)
                if(matches(input, pattern))
                    return true;

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 loadFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("OverlyBroadThrowsClause")
    private List<IndexDataPair<String>> loadFile(final Path path, final Charset charset) throws IOException{
        //read entire file in memory
        final List<String> lines = Files.readAllLines(path, charset);
        if(!workerData.isNoHeader())

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 extractMaxScoreIndices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private Deque<IndexDataPair<Integer>> extractMaxScoreIndices(final double maxScore){
        //collect max scores:
        final Deque<IndexDataPair<Integer>> maxScores = new ArrayDeque<>();
        for(int j = 1; j <= m; j ++)
            for(int i = 1; i <= n; i ++)

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
    public final void run(){
        if(watcher == null)
            return;

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 executeDesktopCommand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("ConstantConditions")
    private static boolean executeDesktopCommand(final Desktop.Action action, final Object parameter){
        boolean done = false;
        final Desktop desktop = getDesktopFor(action);
        try{

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 concatenate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static byte[] concatenate(final byte[]... arrays){
        int size = 0;
        for(int i = 0; i < arrays.length; i ++)
            size += (arrays[i] != null? arrays[i].length: 0);

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 extractChildren has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static List<Node> extractChildren(final Node parentNode, final Predicate<Node> extractionCondition){
        final ArrayList<Node> children = new ArrayList<>(0);
        if(parentNode != null){
            final NodeList nodes = parentNode.getChildNodes();
            final int length = nodes.getLength();
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/services/XMLManager.java - About 25 mins to fix

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 containsAffixes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static boolean containsAffixes(final List<String> amf, final MorphologicalTag[] tags){
        for(final MorphologicalTag tag : tags)
            for(final String elem : amf)
                if(tag.isSupertypeOf(elem))
                    return true;
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/parsers/vos/AffixEntry.java - About 25 mins to fix

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 extractFileList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static List<String> extractFileList(final File projectFolder, final File[] excludeFolderBut){
        final List<File> exclusions = new ArrayList<>(excludeFolderBut.length);
        for(final File file : excludeFolderBut)
            if(file != null)
                exclusions.add(file.getParentFile());
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/services/ZipManager.java - About 25 mins to fix

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 createInnerProcessorBySize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private BiConsumer<IndexDataPair<String>, Long> createInnerProcessorBySize(
            final Consumer<IndexDataPair<String>> dataProcessor, final long fileSize){
        final AtomicLong progress = new AtomicLong(1);
        final AtomicInteger progressIndex = new AtomicInteger(1);
        final int progressStep = (int)Math.ceil(fileSize / 100.f);

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

Severity
Category
Status
Source
Language