Showing 36 of 36 total issues
Method DoTask
has a Cognitive Complexity of 80 (exceeds 20 allowed). Consider refactoring. Open
public static void DoTask(Task task)
{
switch (task.Type)
{
case Type.FileSystemDelete:
- Read upRead up
- Create a ticketCreate a ticket
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 DoTask
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void DoTask(Task task)
{
switch (task.Type)
{
case Type.FileSystemDelete:
- Create a ticketCreate a ticket
Method HasFileOrDirectoryAccess
has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring. Open
private bool HasFileOrDirectoryAccess(FileSystemRights right,
AuthorizationRuleCollection acl)
{
bool allow = false;
bool inheritedAllow = false;
- Read upRead up
- Create a ticketCreate a ticket
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 HasFileOrDirectoryAccess
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private bool HasFileOrDirectoryAccess(FileSystemRights right,
AuthorizationRuleCollection acl)
{
bool allow = false;
bool inheritedAllow = false;
- Create a ticketCreate a ticket
Method Read
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Status Read(string memoPath)
{
bool readSuccess = false;
bool tasksStarted = false;
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (currentRule.IsInherited)
{
inheritedDeny = true;
}
else
- Create a ticketCreate a ticket
Method GetTokenInformation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static extern bool GetTokenInformation(IntPtr TokenHandle, TokenInformationClass TokenInformationClass, IntPtr TokenInformation, uint TokenInformationLength, out uint ReturnLength);
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
public bool HasAccess(FileInfo file, FileSystemRights right)
{
// Get the collection of authorization rules that apply to the file.
AuthorizationRuleCollection acl = file.GetAccessControl()
.GetAccessRules(true, true, typeof(SecurityIdentifier));
- Read upRead up
- Create a ticketCreate a ticket
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 60.
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
public bool HasAccess(DirectoryInfo directory, FileSystemRights right)
{
// Get the collection of authorization rules that apply to the directory.
AuthorizationRuleCollection acl = directory.GetAccessControl()
.GetAccessRules(true, true, typeof(SecurityIdentifier));
- Read upRead up
- Create a ticketCreate a ticket
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 60.
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
Inline HTML Open
<img src="https://api.codeclimate.com/v1/badges/3b16d575a2bd4c3bdb93/test_coverage" />
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Inline HTML Open
<a href="https://codecov.io/gh/BinToss/Intern">
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Line length Open
<img src="https://api.codeclimate.com/v1/badges/3b16d575a2bd4c3bdb93/maintainability" />
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD013 - Line length
Tags: line_length
Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)
This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.
This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.
You also have the option to exclude this rule for code blocks and tables. To
do this, set the code_blocks
and/or tables
parameters to false.
Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.
Headers should be surrounded by blank lines Open
# TODO
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD022 - Headers should be surrounded by blank lines
Tags: headers, blank_lines
Aliases: blanks-around-headers
This rule is triggered when headers (any style) are either not preceded or not followed by a blank line:
# Header 1
Some text
Some more text
## Header 2
To fix this, ensure that all headers have a blank line both before and after (except where the header is at the beginning or end of the document):
# Header 1
Some text
Some more text
## Header 2
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse headers that don't have a blank line before, and will parse them as regular text.
Headers should be surrounded by blank lines Open
# Badge dump
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD022 - Headers should be surrounded by blank lines
Tags: headers, blank_lines
Aliases: blanks-around-headers
This rule is triggered when headers (any style) are either not preceded or not followed by a blank line:
# Header 1
Some text
Some more text
## Header 2
To fix this, ensure that all headers have a blank line both before and after (except where the header is at the beginning or end of the document):
# Header 1
Some text
Some more text
## Header 2
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse headers that don't have a blank line before, and will parse them as regular text.
Inline HTML Open
<html>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Inline HTML Open
<img src="https://codecov.io/gh/BinToss/Intern/branch/main/graph/badge.svg?token=CB3IJ7PZJ1"/>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Inline HTML Open
<a href="https://codeclimate.com/github/BinToss/Intern/test_coverage">
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Multiple consecutive blank lines Open
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD012 - Multiple consecutive blank lines
Tags: whitespace, blank_lines
Aliases: no-multiple-blanks
This rule is triggered when there are multiple consecutive blank lines in the document:
Some text here
Some more text here
To fix this, delete the offending lines:
Some text here
Some more text here
Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.
Line length Open
- Define Exit Codes used to determine if greater authorization is required to complete a task.
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD013 - Line length
Tags: line_length
Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)
This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.
This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.
You also have the option to exclude this rule for code blocks and tables. To
do this, set the code_blocks
and/or tables
parameters to false.
Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.
Inline HTML Open
<a href="https://codeclimate.com/github/BinToss/Intern/maintainability">
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.