Showing 801 of 806 total issues
File streets.js
has 515 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { v4 as uuidv4 } from 'uuid'
import models from '../../db/models/index.js'
import logger from '../../lib/logger.js'
import { ERRORS, asStreetJson } from '../../lib/util.js'
import { updateToLatestSchemaVersion } from '../../lib/street_schema_update.js'
- Create a ticketCreate a ticket
File thumbnail.js
has 512 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { images } from '../app/load_resources'
import { drawLine } from '../util/canvas_drawing'
import { prettifyWidth } from '../util/width_units'
import { getSkyboxDef, makeCanvasGradientStopArray } from '../sky'
import {
- Create a ticketCreate a ticket
Function Variants
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
function Variants (props: VariantsProps): React.ReactElement | null {
const { type, position } = props
// Get the appropriate variant information
const variant = useSelector((state) => {
- 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
Function Variants
has 202 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Variants (props: VariantsProps): React.ReactElement | null {
const { type, position } = props
// Get the appropriate variant information
const variant = useSelector((state) => {
- Create a ticketCreate a ticket
Function ProfileSettings
has 199 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ProfileSettings (): React.ReactElement | null {
const displayNameInputRef = useRef<HTMLInputElement>(null)
const user = useSelector((state) => state.user.signInData?.details)
const [displayNameValue, setDisplayNameValue] = useState(
user?.displayName ?? user?.id ?? ''
- Create a ticketCreate a ticket
File view.js
has 492 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { images } from '../app/load_resources'
import { formatMessage } from '../locales/locale'
import { saveStreetToServerIfNecessary } from '../streets/data_model'
import { recalculateWidth } from '../streets/width'
import store from '../store'
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
function handleErrors (error) {
switch (error) {
case ERRORS.USER_NOT_FOUND:
res.status(404).json({ status: 404, msg: 'User not found.' })
return
- 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 189.
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
function handleErrors (error) {
switch (error) {
case ERRORS.USER_NOT_FOUND:
res.status(404).json({ status: 404, msg: 'User not found.' })
return
- 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 189.
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 post
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
export async function post (req, res) {
const handleCreateUser = function (user) {
if (!user) {
res.status(500).json({
status: 500,
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
<div className="col col--4 col--offset-2" style={{ marginBottom: "1em" }}>
<div
className="text--center padding-horiz--md"
style={{ height: "100%" }}
>
- 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 185.
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
<div className="col col--4" style={{ marginBottom: "1em" }}>
<div
className="text--center padding-horiz--md"
style={{ height: "100%" }}
>
- 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 185.
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 post
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function post (req, res) {
const handleCreateUser = function (user) {
if (!user) {
res.status(500).json({
status: 500,
- Create a ticketCreate a ticket
Function UpDownInput
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UpDownInput (props: UpDownInputProps): React.ReactElement {
// Destructure props with default values
const {
value,
minValue,
- Create a ticketCreate a ticket
Function post
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
export async function post (req, res) {
let body
const street = {}
street.id = uuidv4()
const requestIp = function (req) {
- 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
Function GeotagDialog
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
function GeotagDialog () {
// this kinda goofy props object is a result of refactoring
// some legacy code. definetly worth refactoring further in the future
// if it causes other problems or confusion
const props = {
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
it('handles different hostname cases', () => {
expect(isUrlExternal('http://example.com', SELF_HOSTNAME)).toBeTruthy()
expect(
isUrlExternal('http://example.com/with/path/params', SELF_HOSTNAME)
).toBeTruthy()
- 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 165.
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
it('handles same hostname cases', () => {
expect(isUrlExternal('http://streetmix.net', SELF_HOSTNAME)).toBeFalsy()
expect(
isUrlExternal('http://streetmix.net/with/path/params', SELF_HOSTNAME)
).toBeFalsy()
- 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 165.
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 post
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
export async function post (req, res) {
let json
// The request payload is a stringified JSON due to the data URL for the street thumbnail being too large.
// Setting the bodyParser.text({ limit }) works for a specific route whereas bodyParser.json({ limit }) does not.
- Create a ticketCreate a ticket
Function render
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { sendingEmail, emailSent, signingIn } = this.state
if (sendingEmail || signingIn) {
return this.renderSignInWaiting()
- Create a ticketCreate a ticket
Function post
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function post (req, res) {
let body
const street = {}
street.id = uuidv4()
const requestIp = function (req) {
- Create a ticketCreate a ticket