Showing 48 of 168 total issues
Function render
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { query, leftDrawerVisible, location } = this.props;
const styles = FilterBar.styles;
const isListing = location.pathname.startsWith('/listings');
const isSeek = location.pathname.startsWith('/seeks');
File FilterBar.js
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
withRouter,
Function render
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { listing, expanded } = this.props;
const styles = ListingCard.styles;
const favoriteButtonBackground = this.props.listing.isStarred ? grey300 : 'transparent';
Function build
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function build(previousFileSizes) {
console.log('Creating an optimized production build...');
webpack(config).run((err, stats) => {
if (err) {
printErrors('Failed to compile.', [err]);
Function renderSidebarItems
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderSidebarItems() {
const styles = NavigationDrawer.styles;
const currentMajorPath = this.props.location.pathname;
return (
File ListingCard.js
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
Link,
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { handleSubmit, pristine, reset, submitting } = this.props;
const styles = ComposeForm.styles;
return (
Function render
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { seek, expanded } = this.props;
const styles = SeekCard.styles;
const boughtButtonBackground = this.props.seek.isActive ? 'transparent' : grey300;
Function setupCompiler
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setupCompiler(host, port, protocol) {
// "Compiler" is a low-level interface to Webpack.
// It lets us listen to some events and provide our own custom messages.
compiler = webpack(config, handleCompile);
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const styles = ComposeOverlay.styles;
if (!this.props.currentUserLoading && !this.props.user.loggedIn) {
return <RedirectToCas />;
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { watch } = this.props;
const styles = WatchCard.styles;
return (
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { handleSubmit, pristine, reset, submitting } = this.props;
const styles = SeekComposeForm.styles;
return (
Function render
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const styles = ComposeOverlay.styles;
if (!this.props.currentUserLoading && !this.props.user.loggedIn) {
return <RedirectToCas />;
- 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 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const styles = App.styles;
return (
<div className="App">
Function render
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const styles = PhotosList.styles;
return (
<div>
Function parseQuery
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export const parseQuery = ({ location, match }) => {
const queryStrings = parse(location.search);
const query = {
query: queryStrings.query,
minPrice: (queryStrings.minPrice === '' || queryStrings.minPrice === undefined) ? undefined : parseInt(queryStrings.minPrice, 10),
- 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 ReadListings
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func ReadListings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
query := models.NewListingQuery()
// Get limit from params
if limit, err := strconv.ParseUint(r.URL.Query().Get("limit"), 10, 64); err == nil && limit != 0 {
Function mailBuyer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mailBuyer(seek, data, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'MAIL_BUYER_REQUEST',
seek,
Function mailSeller
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mailSeller(listing, data, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'MAIL_SELLER_REQUEST',
listing,
Function buildListingQuery
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func buildListingQuery(query *ListingQuery) sq.SelectBuilder {
stmt := psql.
Select(
"listings.key_id",
"listings.creation_date",