Showing 1,372 of 1,372 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
ticket_values['description'] = wrap(
ticket_values.get('description', ''), self.COLS,
initial_indent=' ', subsequent_indent=' ', linesep='\n',
ambiwidth=self.ambiwidth)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 40.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
ticket_values['description'] = wrap(
ticket_values.get('description', ''), self.COLS,
initial_indent=' ', subsequent_indent=' ', linesep='\n',
ambiwidth=self.ambiwidth)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 40.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
tag.tr(tag.th(tag.em(_("Prefix"))),
tag.th(tag.em(_("Trac Site")))),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 40.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
return tag.table(tag.tr(tag.th(tag.em(_("Prefix"))),
tag.th(tag.em(_("Site")))),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 40.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function _do_send
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _do_send(self, transport, event, message, cc_addrs, bcc_addrs):
notify_sys = NotificationSystem(self.env)
smtp_from = notify_sys.smtp_from
smtp_from_name = notify_sys.smtp_from_name or self.env.project_name
smtp_replyto = notify_sys.smtp_replyto
Function parse_args
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_args(args=None):
parser = argparse.ArgumentParser()
class _AuthAction(argparse.Action):
Function _render_ics
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _render_ics(self, req, milestones):
req.send_response(200)
req.send_header('Content-Type', 'text/calendar;charset=utf-8')
buf = io.StringIO()
Function code_block_directive
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def code_block_directive(name, arguments, options, content, lineno,
Function trac_directive
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def trac_directive(name, arguments, options, content, lineno,
Function enableExpandDir
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.enableExpandDir = function(parent_tr, rows, qargs, autoexpand) {
// the ancestors folder ids are present in the parent_tr class attribute
var ancestor_folderids = [];
if (parent_tr) // rows are logical children of the parent_tr row
Function encloseSelection
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function encloseSelection(prefix, suffix) {
textarea.focus();
var start, end, sel, scrollPos, subst;
if (document.selection != undefined) {
sel = document.selection.createRange().text;
Function _process_ticket_request
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _process_ticket_request(self, req):
id = req.args.getint('id')
version = req.args.getint('version', None)
if req.is_xhr and 'preview_comment' in req.args:
Function _render_comment_diff
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _render_comment_diff(self, req, ticket, data, cnum):
"""Show differences between two versions of a ticket comment."""
req.perm(ticket.resource).require('TICKET_VIEW')
new_version = req.args.getint('version', 1)
old_version = req.args.getint('old_version', new_version)
Function upgrade
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def upgrade(self, backup=False, backup_dest=None):
"""Upgrade database.
:param backup: whether or not to backup before upgrading
:param backup_dest: name of the backup file
- 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 get_repositories_by_dir
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_repositories_by_dir(self, directory):
"""Retrieve the repositories based on the given directory.
:param directory: the key for identifying the repositories.
:return: list of `Repository` instances.
- 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 resource_exists
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def resource_exists(self, resource):
if resource.realm == self.repository_realm:
reponame = resource.id
else:
reponame = resource.parent.id
- 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 logger_handler_factory
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def logger_handler_factory(logtype='syslog', logfile=None, level='WARNING',
logid='Trac', format=None):
logger = logging.getLogger(logid)
logtype = logtype.lower()
if logtype == 'file':
- 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 handle_match
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_match(self, fullmatch):
for itype, match in fullmatch.groupdict().items():
if match and itype not in self.wikiparser.helper_patterns:
# Check for preceding escape character '!'
if match[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 normalize_rev
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def normalize_rev(self, rev):
if rev is None or isinstance(rev, str) and \
rev.lower() in ('', 'head', 'latest', 'youngest'):
return self.rev_db(self.youngest_rev or 0)
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
Function get_search_results
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_search_results(self, req, terms, filters):
if 'changeset' not in filters:
return
rm = RepositoryManager(self.env)
repositories = {repos.params['id']: repos
- 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"