Showing 11 of 31 total issues
Function draw
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw () {
const { repo, repos } = this.props
const reposToDraw = repo ? [repo] : repos
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { repo, progress } = this.props
if (!repo) { return this.renderPlaceholder() }
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { results, loading, selected } = this.state
const { askInProgress } = this.props
return (
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { featured, trending } = this.props
return (
<div>
Function fetchStarPage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const fetchStarPage = (name, _id, starsCount, page, io) => {
return q.Promise((resolve, reject) => {
r.get(`https://api.github.com/repos/${name}/stargazers?page=${page}&per_page=100`)
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { current } = this.props
const { reposInProgress } = this.state
const battleUrl = `${config.clientUrl}battle/${current.map(r => r.name).join(';').replace(/\//g, ',')}`
Function search
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
search (value) {
const { loading } = this.state
// cancel current search if loading
if (loading) {
Function fetchRepo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fetchRepo = name => {
return q.Promise((resolve, reject) => {
r.get(`https://api.github.com/repos/${name}`)
.set('Authorization', `token ${config.github}`)
Function askRepo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const askRepo = repo => dispatch => new Promise((resolve, reject) => {
if (repo.stars) { return resolve(repo) }
dispatch(askRepoStart())
r.get(`${api}/repos/${repo.name}`)
.end((err, res) => {
- 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 searchRepos
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const searchRepos = term => Promise.all([
// Github repos results
new Promise((resolve, reject) => {
- 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 componentDidUpdate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate () {
const { selectedNode, scrollNode } = this
if (selectedNode && scrollNode) {
const selectedRect = selectedNode.getBoundingClientRect()
const scrollRect = scrollNode.getBoundingClientRect()
- 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"