Showing 47 of 100 total issues
File __init__.py
has 1601 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of fprettify.
# Copyright (C) 2016-2019 Patrick Seewald, CP2K developers group
File __init__.py
has 770 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of fprettify.
# Copyright (C) 2016-2019 Patrick Seewald, CP2K developers group
Function process_lines_of_fline
has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring. Open
def process_lines_of_fline(self, f_line, lines, rel_ind, rel_ind_con,
line_nr, indent_fypp=True, manual_lines_indent=None):
"""
Process all lines that belong to a Fortran line `f_line`.
- 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
Function next_fortran_line
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
def next_fortran_line(self):
"""Reads a group of connected lines (connected with &, separated by newline or semicolon)
returns a touple with the joined line, and a list with the original lines.
Doesn't support multiline character constants!
"""
- 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
Function run
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def run(argv=sys.argv): # pragma: no cover
"""Command line interface"""
try:
import configargparse as argparse
- 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
Function reformat_ffile_combined
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
def reformat_ffile_combined(infile, outfile, impose_indent=True, indent_size=3, strict_indent=False, impose_whitespace=True,
case_dict={},
impose_replacements=False, cstyle=False, whitespace=2, whitespace_dict={}, llength=132,
strip_comments=False, format_decl=False, orig_filename=None, indent_fypp=True, indent_mod=True):
- 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
Function add_whitespace_charwise
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
def add_whitespace_charwise(line, spacey, scope_parser, format_decl, filename, line_nr):
"""add whitespace character wise (no need for context aware parsing)"""
line_ftd = line
pos_eq = []
end_of_delim = -1
- 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
Function __align_line_continuations
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def __align_line_continuations(self, line, is_decl, is_use, indent_size, line_nr):
"""align continuation lines."""
indent_list = self._br_indent_list
level = self._level
- 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
Function replace_keywords_single_fline
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def replace_keywords_single_fline(f_line, case_dict):
"""
format a single Fortran line - change case of keywords
"""
- 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
Function __next__
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def __next__(self):
pos, char = next(self._it)
char2 = self._content[pos:pos+2]
- 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
FPrettifyTestCase
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class FPrettifyTestCase(unittest.TestCase):
"""
test class to be recognized by unittest.
"""
Function addtestmethod
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def addtestmethod(testcase, fpath, ffile):
"""add a test method for each example."""
def testmethod(testcase):
"""this is the test method invoked for each example."""
- 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
Function add_whitespace_context
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def add_whitespace_context(line, spacey):
"""
for context aware whitespace formatting we extract line parts that are
not comments or strings in order to be able to apply a context aware regex.
"""
- 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
Function split
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def split(self, line):
partsplit = self._re.split(line)
partsplit_out = []
# exclude splits due to '+/-' in real literals
- 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
Function search
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def search(self, line):
match = self._re.search(line)
if match:
level = 0
- 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
Function preprocess_line
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def preprocess_line(f_line, lines, comments, filename, line_nr, indent_fypp):
"""preprocess lines: identification and formatting of special cases"""
is_blank = False
prev_indent = False
do_format = False
- 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
Function rm_extra_whitespace
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def rm_extra_whitespace(line, format_decl):
"""rm all unneeded whitespace chars, except for declarations"""
line_ftd = ''
pos_prev = -1
pos = -1
- 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
Function write_formatted_line
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def write_formatted_line(outfile, indent, lines, orig_lines, indent_special, llength, use_same_line, is_omp_conditional, label, filename, line_nr):
"""Write reformatted line to file"""
for ind, line, orig_line in zip(indent, lines, orig_lines):
- 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
Function replace_relational_single_fline
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def replace_relational_single_fline(f_line, cstyle):
"""
format a single Fortran line - replaces scalar relational
operators in logical expressions to either Fortran or C-style.
.lt. <--> <
- 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
Function parse_fprettify_directives
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse_fprettify_directives(lines, comment_lines, in_format_off_block, filename, line_nr):
"""
parse formatter directives '!&' and line continuations starting with an
ampersand.
"""
- 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"