Showing 48 of 168 total issues
Function addMiddleware
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addMiddleware(devServer) {
// `proxy` lets you to specify a fallback server during development.
// Every unrecognized request will be forwarded to it.
var proxy = require(paths.appPackageJson).proxy;
devServer.use(historyApiFallback({
Function postWatch
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function postWatch(watch, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'POST_WATCH_REQUEST',
});
Function postSeek
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function postSeek(seek, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'POST_SEEK_REQUEST',
seek,
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const styles = ActionBar.styles;
const Title = () => (
<Link
Function deleteWatch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function deleteWatch(watch, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'DELETE_WATCH_REQUEST',
watch,
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const rest = omit(this.props, 'user');
const styles = LoggedInMenu.styles;
return (
Function postListing
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function postListing(listing, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'POST_LISTING_REQUEST',
});
Function updateSeek
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function updateSeek(seek, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'UPDATE_SEEK_REQUEST',
});
Function updateListing
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function updateListing(listing, successMessage) {
return function (dispatch, getState) {
dispatch({
type: 'UPDATE_LISTING_REQUEST',
});
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const styles = SearchBar.styles;
const hintText = (this.props.displayMode === 'seeks')
? (<span className="hint-text">What do you want to sell?</span>)
: (<span className="hint-text">What do you want to buy?</span>);
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { listing, expanded } = this.props;
const styles = ListingCard.styles;
const favoriteButtonBackground = this.props.listing.isStarred ? grey300 : 'transparent';
- 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 contactPost
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func contactPost(w http.ResponseWriter, r *http.Request, ps httprouter.Params,
read models.PostReader, posterTemplate models.MailTemplate, readerTemplate models.MailTemplate) {
Function setComposeState
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function setComposeState(show = false, isEdit = false, mode = 'listings', listing, seek) {
Function CreatePhoto
has 5 return statements (exceeds 4 allowed). Open
func CreatePhoto(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
user := getUsername(r)
if user == "" {
Error(w, http.StatusUnauthorized)
return
Function getExecResultCode
has 5 return statements (exceeds 4 allowed). Open
func getExecResultCode(result sql.Result, err error) (int, error) {
if err != nil {
return http.StatusInternalServerError, err
}
numRows, err := result.RowsAffected()
Function contactPost
has 5 return statements (exceeds 4 allowed). Open
func contactPost(w http.ResponseWriter, r *http.Request, ps httprouter.Params,
read models.PostReader, posterTemplate models.MailTemplate, readerTemplate models.MailTemplate) {
id := ps.ByName("id")
Function ReadSeeks
has 5 return statements (exceeds 4 allowed). Open
func ReadSeeks(db *sql.DB, query *SeekQuery) ([]*Seek, int, error) {
if query.UserID == 0 && query.OnlyMine {
return nil, http.StatusUnauthorized, errors.New("unauthenticated user attempted to view profile data")
}
Function render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { query, leftDrawerVisible, location } = this.props;
const styles = FilterBar.styles;
const isListing = location.pathname.startsWith('/listings');
const isSeek = location.pathname.startsWith('/seeks');
- 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 componentWillReceiveProps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
componentWillReceiveProps(nextProps) {
if (this.props.listings.length > nextProps.listings.length) {
this.setState({ openCardId: -1 });
}
- 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 5 return statements (exceeds 4 allowed). Open
func ReadListings(db *sql.DB, query *ListingQuery) ([]*Listing, int, error) {
if query.UserID == 0 && (query.OnlyStarred || query.OnlyMine) {
return nil, http.StatusUnauthorized, errors.New("unauthenticated user attempted to view profile data")
}