Showing 52 of 52 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
for i := uint(0); i < amount; i++ {
row := rows[i]
/* Write value*/
column, err := r.normalizeColumn(len(row))
if err != nil {
- 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 125.
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
for i := int(amount - 1); i >= 0; i-- {
row := rows[i]
/* Write value*/
column, err := r.normalizeColumn(len(row))
if err != nil {
- 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 125.
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
Method Reader.ReadPrev
has 7 return statements (exceeds 4 allowed). Open
func (r *Reader) ReadPrev(n uint) error {
/* Check frame */
if r.frame == nil {
return fmt.Errorf("init frame")
}
Method CanvasController.InputCapture
has 6 return statements (exceeds 4 allowed). Open
func (c *CanvasController) InputCapture(event *tcell.EventKey) *tcell.EventKey {
minAmount := uint(math.Round(0.1 * float64(c.reader.FrameCap())))
maxAmount := uint(math.Round(0.5 * float64(c.reader.FrameCap())))
switch event.Key() {
case tcell.KeyRight:
Method CanvasController.DrawFunc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (c *CanvasController) DrawFunc(screen tcell.Screen, x int, y int, width int, height int) (int, int, int, int) {
Method Reader.ReadNext
has 5 return statements (exceeds 4 allowed). Open
func (r *Reader) ReadNext(n uint) error {
/* Check frame */
if r.frame == nil {
return fmt.Errorf("init frame")
}
Method Reader.readLines
has 5 return statements (exceeds 4 allowed). Open
func (r *Reader) readLines(begin, end uint) ([][]string, error) {
if begin >= end {
return nil, fmt.Errorf("begin can't be grater or equal to end")
}
Line length Open
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Read upRead up
- 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.
exported method Frame.InsertBackward should have comment or be unexported Open
func (f *Frame) InsertBackward(value float64) {
- Exclude checks
exported method Reader.SetFrameCap should have comment or be unexported Open
func (r *Reader) SetFrameCap(n int) {
- Exclude checks
exported type TUI should have comment or be unexported Open
type TUI struct {
- Exclude checks
Line length Open
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Read upRead up
- 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.
exported type CanvasController should have comment or be unexported Open
type CanvasController struct {
- Exclude checks
exported function NewCanvasController should have comment or be unexported Open
func NewCanvasController(reader *Reader, box *tview.Box, logTV *tview.TextView) *CanvasController {
- Exclude checks
exported method Frame.Len should have comment or be unexported Open
func (f *Frame) Len() int {
- Exclude checks
exported var BOF should have comment or be unexported Open
var BOF = errors.New("BOF")
- Exclude checks
exported method TUI.Run should have comment or be unexported Open
func (t *TUI) Run() error {
- Exclude checks
exported method Reader.MoveNext should have comment or be unexported Open
func (r *Reader) MoveNext(n uint) {
- Exclude checks
Multiple top level headers in the same document Open
# Example
- Read upRead up
- Exclude checks
MD025 - Multiple top level headers in the same document
Tags: headers
Aliases: single-h1
Parameters: level (number; default 1)
This rule is triggered when a top level header is in use (the first line of the file is a h1 header), and more than one h1 header is in use in the document:
# Top level header
# Another top level header
To fix, structure your document so that there is a single h1 header that is the title for the document, and all later headers are h2 or lower level headers:
# Title
## Header
## Another header
Rationale: A top level header is a h1 on the first line of the file, and serves as the title for the document. If this convention is in use, then there can not be more than one title for the document, and the entire document should be contained within this header.
Note: The level
parameter can be used to change the top level (ex: to h2) in
cases where an h1 is added externally.
Ordered list item prefix Open
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Read upRead up
- Exclude checks
MD029 - Ordered list item prefix
Tags: ol
Aliases: ol-prefix
Parameters: style ("one", "ordered"; default "one")
This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').
Example valid list if the style is configured as 'one':
1. Do this.
1. Do that.
1. Done.
Example valid list if the style is configured as 'ordered':
1. Do this.
2. Do that.
3. Done.