Showing 138 of 138 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
function convertFirebaseTimestampFieldsIntoDate(photo) {
const newPhoto = _.cloneDeep(photo);
_.forEach(newPhoto, (value, field) => {
if (value.toDate) {
newPhoto[field] = value.toDate();
- 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 75.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
function convertFirebaseTimestampFieldsIntoDate(photo) {
const newPhoto = _.cloneDeep(photo);
_.forEach(newPhoto, (value, field) => {
if (value.toDate) {
newPhoto[field] = value.toDate();
- 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 75.
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 render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const props = { ...this.props };
const field = {
name: "brand",
title: "Brand",
Function uploadPhoto
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function uploadPhoto(data, imgSrc, onProgress) {
const rtn = {};
let canceled = false;
let uploadTask;
let resolve;
Function hostMetadata
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function hostMetadata(req, res) {
const BUCKET = config.FIREBASE.config.storageBucket;
const SERVER_URL = config.metadata.serverUrl;
const TW_SITE = config.metadata.twSite;
const TW_CREATOR = config.metadata.twCreator;
Function onAuthStateChanged
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onAuthStateChanged = (fn) => {
onUserChangeCallBackFn = fn;
const firebaseStatusChange = (user) => {
currentUser = user;
if (config.USER.ENABLE_GRAVATAR_PROFILES && currentUser) {
Function updateStats
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
.onPublish(async (message, context) => {
const stats = {
totalUploaded: 0,
moderated: 0,
published: 0,
Function renderTableBody
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderTableBody() {
const { usersLeaderboard, classes, user } = this.props;
const userId = user && user.id;
sortArrayByObjectKey(
usersLeaderboard,
Function render
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
// const { fullScreen, handleClose, classes } = this.props; //to use uncomment "line fullSreen={fullScreen}"
const { handleClose, classes } = this.props; //comment this and uncomment above line to use fullScreen T&C page
return (
<Dialog
Function firebaseStatusChange
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const firebaseStatusChange = (user) => {
currentUser = user;
if (config.USER.ENABLE_GRAVATAR_PROFILES && currentUser) {
gtagSetId(user.uid);
gtagEvent("Logged in", "User", user.uid);
Function ProfileTextField
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ProfileTextField = connect(mapStateToProps)(withStyles(styles)(function (props) {
const { user, className, fieldName, classes, maxLength, placeholder } = props;
const originalFieldValue = user[fieldName] || "";
const [updating, setUpdating] = useState(false);
Function drawByMonth
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawByMonth(months, ctx) {
let sortedMonths = _.map(months, (amount, date) => {
return {
date: new Date(date),
amount,
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
title: utils.customiseString("welcome", "Be part of the solution"),
img: (
<img
src={utils.customiseString("welcome", "croud.png")}
- 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 67.
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
{
title: utils.customiseString("welcome", "Global research"),
img: (
<img
src={utils.customiseString("welcome", "chart.png")}
- 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 67.
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 render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
photoSelected,
handleRejectClick,
handleApproveClick,
Function render
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { classes } = this.props;
return (
<PageWrapper label={config.PAGES.writeFeedback.label} handleClose={this.props.handleClose}>
- 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 render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { classes } = this.props;
const gpsOffline = !this.context.geolocation.online;
const gpsDisabled = !this.context.geolocation.updated;
Function GeolocationContextProvider
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const GeolocationContextProvider = (props) => {
const [geolocation, setGeolocation] = useState(new MapLocation());
const locationWatherId = useRef(null);
useEffect(() => {
Similar blocks of code found in 2 locations. Consider refactoring. Open
<DialogActions color="secondary">
<Button
className={classes.button}
fullWidth
variant="contained"
- 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 65.
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
<DialogActions color="secondary">
<Button
className={classes.button}
fullWidth
color="secondary"
- 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 65.
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