Showing 248 of 248 total issues
Function run_sender
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_sender(protocol, brokers, project, token, cp, log):
Function _save_msg_to_queue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _save_msg_to_queue(self, body, empaid):
"""Extract message contents and add to the accept or reject queue."""
if isinstance(body, bytes):
body = body.decode('ascii')
- 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 verify_cert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def verify_cert(certstring, capath, check_crls=True):
"""Verify that the certificate is signed by a CA with a cert in capath.
Note that I've had to compare strings in the output of openssl to check
for verification, which may make this brittle.
- 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 start_connection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def start_connection(self):
"""Start existing connection and subscribe to the relevant topics.
If the timeout is reached without receiving confirmation of
connection, raise an exception.
- 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
Avoid too many return
statements within this function. Open
return message, signer, None
Avoid too many return
statements within this function. Open
return certificate_public_key.strip() == private_public_key.strip()
Function shutdown
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def shutdown(self):
"""Close the connection then remove the pidfile."""
self.close_connection()
if self._pidfile is not None:
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
Function get_protocol
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_protocol(cp, log):
"""Get the protocol from a ConfigParser object, defaulting to STOMP."""
try:
if 'sender' in cp.sections():
protocol = cp.get('sender', 'protocol')
- 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_messages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_messages(self, sort_by_mtime=False):
"""
Get the messages stored in this MessageDirectory.
if sort_by_mtime is set to True, the returned list is guaranteed to be
- 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
Inconsistent indentation for list items at the same level Open
* Download the example [configuration file](conf/sender.cfg)
- Read upRead up
- Exclude checks
MD005 - Inconsistent indentation for list items at the same level
Tags: bullet, ul, indentation
Aliases: list-indent
This rule is triggered when list items are parsed as being at the same level, but don't have the same indentation:
* Item 1
* Nested Item 1
* Nested Item 2
* A misaligned item
Usually this rule will be triggered because of a typo. Correct the indentation for the list to fix it:
* Item 1
* Nested Item 1
* Nested Item 2
* Nested Item 3
Inconsistent indentation for list items at the same level Open
* The line `-v /path/to/persistently/log:/var/log/apel \` is only required if you want to access the sender log as a file. If `console: true` is set in your `sender.cfg`, the container will also log to stdout/stderr.
- Read upRead up
- Exclude checks
MD005 - Inconsistent indentation for list items at the same level
Tags: bullet, ul, indentation
Aliases: list-indent
This rule is triggered when list items are parsed as being at the same level, but don't have the same indentation:
* Item 1
* Nested Item 1
* Nested Item 2
* A misaligned item
Usually this rule will be triggered because of a typo. Correct the indentation for the list to fix it:
* Item 1
* Nested Item 1
* Nested Item 2
* Nested Item 3
Inconsistent indentation for list items at the same level Open
* To stop, run `service apelssm stop`
- Read upRead up
- Exclude checks
MD005 - Inconsistent indentation for list items at the same level
Tags: bullet, ul, indentation
Aliases: list-indent
This rule is triggered when list items are parsed as being at the same level, but don't have the same indentation:
* Item 1
* Nested Item 1
* Nested Item 2
* A misaligned item
Usually this rule will be triggered because of a typo. Correct the indentation for the list to fix it:
* Item 1
* Nested Item 1
* Nested Item 2
* Nested Item 3
Inconsistent indentation for list items at the same level Open
* Run the following docker command to launch containerized receiver process
- Read upRead up
- Exclude checks
MD005 - Inconsistent indentation for list items at the same level
Tags: bullet, ul, indentation
Aliases: list-indent
This rule is triggered when list items are parsed as being at the same level, but don't have the same indentation:
* Item 1
* Nested Item 1
* Nested Item 2
* A misaligned item
Usually this rule will be triggered because of a typo. Correct the indentation for the list to fix it:
* Item 1
* Nested Item 1
* Nested Item 2
* Nested Item 3
Inconsistent indentation for list items at the same level Open
* The line `-v /path/to/persistently/log:/var/log/apel \` is only required if you want to access the receiver log as a file. If `console: true` is set in your `receiver.cfg`, the container will also log to stdout/stderr.
- Read upRead up
- Exclude checks
MD005 - Inconsistent indentation for list items at the same level
Tags: bullet, ul, indentation
Aliases: list-indent
This rule is triggered when list items are parsed as being at the same level, but don't have the same indentation:
* Item 1
* Nested Item 1
* Nested Item 2
* A misaligned item
Usually this rule will be triggered because of a typo. Correct the indentation for the list to fix it:
* Item 1
* Nested Item 1
* Nested Item 2
* Nested Item 3
Inconsistent indentation for list items at the same level Open
* Run 'ssmreceive'
- Read upRead up
- Exclude checks
MD005 - Inconsistent indentation for list items at the same level
Tags: bullet, ul, indentation
Aliases: list-indent
This rule is triggered when list items are parsed as being at the same level, but don't have the same indentation:
* Item 1
* Nested Item 1
* Nested Item 2
* A misaligned item
Usually this rule will be triggered because of a typo. Correct the indentation for the list to fix it:
* Item 1
* Nested Item 1
* Nested Item 2
* Nested Item 3
Consider starting bulleted lists at the beginning of the line Open
* Run `service apelssm start`
- Read upRead up
- Exclude checks
MD006 - Consider starting bulleted lists at the beginning of the line
Tags: bullet, ul, indentation
Aliases: ul-start-left
This rule is triggered when top level lists don't start at the beginning of a line:
Some text
* List item
* List item
To fix, ensure that top level list items are not indented:
Some test
* List item
* List item
Rationale: Starting lists at the beginning of the line means that nested list items can all be indented by the same amount when an editor's indent function or the tab key is used to indent. Starting a list 1 space in means that the indent of the first nested list is less than the indent of the second level (3 characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
Fenced code blocks should be surrounded by blank lines Open
```
- Read upRead up
- Exclude checks
MD031 - Fenced code blocks should be surrounded by blank lines
Tags: code, blank_lines
Aliases: blanks-around-fences
This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:
Some text
```
Code block
```
```
Another code block
```
Some more text
To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):
Some text
```
Code block
```
```
Another code block
```
Some more text
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.
Lists should be surrounded by blank lines Open
* `apt-get install python-daemon`
- Read upRead up
- Exclude checks
MD032 - Lists should be surrounded by blank lines
Tags: bullet, ul, ol, blank_lines
Aliases: blanks-around-lists
This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:
Some text
* Some
* List
1. Some
2. List
Some text
To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):
Some text
* Some
* List
1. Some
2. List
Some text
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.
Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:
* This is
not okay
* This is
okay
Lists should be surrounded by blank lines Open
* Download the example [configuration file](conf/receiver.cfg)
- Read upRead up
- Exclude checks
MD032 - Lists should be surrounded by blank lines
Tags: bullet, ul, ol, blank_lines
Aliases: blanks-around-lists
This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:
Some text
* Some
* List
1. Some
2. List
Some text
To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):
Some text
* Some
* List
1. Some
2. List
Some text
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.
Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:
* This is
not okay
* This is
okay
Bare URL used Open
* Perl: http://search.cpan.org/~lcons/Directory-Queue/
- Read upRead up
- Exclude checks
MD034 - Bare URL used
Tags: links, url
Aliases: no-bare-urls
This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:
For more information, see http://www.example.com/.
To fix this, add angle brackets around the URL:
For more information, see <http:></http:>.
Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.
Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:
`http://www.example.com`