Showing 555 of 555 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (!dayOfMonth) {
switch (monthDelta) {
case -1:
text = messages.month.before
break
- 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 57.
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 3 locations. Consider refactoring. Open
if (!month) {
switch (yearDelta) {
case -1:
text = messages.year.before
break
- 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 57.
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 replaceItem
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected replaceItem(context: HtmlRR0SsgContext, item: HTMLLIElement, i: number): number {
const anchor = item.querySelector(".index-anchor")
let nextIndex: number
if (!anchor) {
const value = item.getAttribute("value")
- 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 prev
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
prev(context: HtmlRR0SsgContext): Link | undefined {
let fileName = context.file.name
if (this.isTimeFile(fileName)) {
const pos = this.timeFiles.indexOf(fileName);
if (pos >= 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 removeIndent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected removeIndent(lines: string[]) {
let minIndent = Number.MAX_VALUE;
for (const line of lines) {
if (line.length > 0) {
let i = 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 createFromFullName
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
createFromFullName(fullName: string): KnownPeople {
let lastName: string
let firstNames: string[]
let commaPos = fullName.indexOf(",")
if (commaPos > 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 execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async execute(context: HtmlRR0SsgContext): Promise<void> {
const file = context.file
const title = file.title
const outDir = "out/"
const url = file.name.startsWith(outDir) ? file.name.substring(outDir.length) : file.name
- 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 getFromRow
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getFromRow(context: RR0SsgContext, row: Element): FuforaCaseSummary {
const fields = row.querySelectorAll("div")
const caseLink = fields[0].firstElementChild as HTMLAnchorElement
const dateFormat = /(?:(\d\d).(\d\d).(\d\d\d\d))?\n?(.+)?/
const dateFields = dateFormat.exec(fields[1].textContent)
Function getSources
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getSources(row: Element, itemContext: HtmlRR0SsgContext): Source[] {
const sources: Source[] = []
const sourceEls = row.querySelectorAll(".source-id")
for (const sourceEl of sourceEls) {
const id = sourceEl.childNodes[0].textContent
Function findPeople
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.findPeople = (_e) => {
const textInput = form.querySelector('input[type=\'search\']')
function normalize (str) {
return str.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').trim()
Function execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async execute(context: HtmlRR0SsgContext): Promise<void> {
const file = context.file
const inDescription = file.meta.description
const outDoc = file.document
let descriptionMeta = outDoc.head.querySelector("meta[name='description']")
Function setTimeContextFrom
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
static setTimeContextFrom(timeContext: TimeContext, parsed: TimeParseResult) {
if (parsed.yearStr) {
const year = parseInt(parsed.yearStr, 10)
if (!Number.isNaN(year)) {
timeContext.setYear(year)
Function readCases
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async readCases(context: RR0SsgContext): Promise<GeipanCaseSummary[]> {
const time = context.time
const day = time.getDayOfMonth()
const dayStartStr = day ? String(day).padStart(2, "0") : "01"
const dayEndStr = day ? String(day).padStart(2, "0") : "31"
Function drawImage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async drawImage(context: HtmlRR0SsgContext, canvasCtx: CanvasRenderingContext2D, dy = 0) {
const outDoc = context.file.document
const docImages = outDoc.documentElement.getElementsByTagName("img")
let widthRatio = 0.5
let imageIndex = 0
Function createFromFullName
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
createFromFullName(fullName: string): KnownPeople {
let lastName: string
let firstNames: string[]
let commaPos = fullName.indexOf(",")
if (commaPos > 0) {
Function indexWords
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected indexWords(context: HtmlRR0SsgContext, outputFile: HtmlSsgFile) {
const pageIndex = this.index.pages.length
const nonSignificant = context.messages.nonSignificantWords
const contents = this.getContents(outputFile.document)
const pageText = contents.toLowerCase()
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.g.append("g")
.attr("class", "axis axis--y")
.call(d3.axisLeft(this.y).ticks(5));
- 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 56.
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
this.errorG.selectAll(this.svg_el + " .axis--y .tick text")
.attr("fill", function (d) {
return this.errorGraphScale(d)
}.bind(this))
- 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 56.
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
this.heatmapG.append("g")
.attr("class", "axis axis--y")
.call(d3.axisLeft(this.heatmapYAxisScale).ticks(5));
- 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 56.
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
this.errorG.selectAll(this.error_chart_el + " .axis--y .tick text")
.attr("fill", function (d) {
return this.errorGraphScale(d)
}.bind(this))
- 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 56.
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