Skip to content

Sourcery refactored master branch#2

Open
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master
Open

Sourcery refactored master branch#2
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Aug 11, 2020

Copy link
Copy Markdown

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment thread factory.py
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
return {col[0]: row[idx] for idx, col in enumerate(cursor.description)}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function dict_factory refactored with the following changes:

  • Convert for loop into dictionary comprehension (dict-comprehension)
  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment thread qml_wrapper.py
return True
else:
return False
return self._task['datetime'] < now

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TaskWrapper.expired refactored with the following changes:

  • Simplify conditional into return statement (return-identity)

Comment thread models/idea.py
result = self.cr.execute("SELECT * from Ideas LIMIT {} OFFSET {}".format(limit, offset))
ideas = result.fetchall()
return ideas
return result.fetchall()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function IdeaModel.load_ideas refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment thread models/idea.py
Comment on lines -48 to +47
idea = result.fetchone()
return idea
return result.fetchone()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function IdeaModel.load_idea refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment thread models/idea.py
Comment on lines -54 to +52
idea = result.fetchone()
return idea
return result.fetchone()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function IdeaModel.load_idea_by_task_id refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment thread models/task.py
result = self.cr.execute("SELECT * from Tasks LIMIT ? OFFSET ?", (limit, offset))
tasks = result.fetchall()
return tasks
return result.fetchall()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TaskModel.load_tasks refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment thread models/task.py
Comment on lines -70 to +69
tasks = result.fetchall()
return tasks
return result.fetchall()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TaskModel.load_tasks_period refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment thread models/task.py
Comment on lines -75 to +73
task = result.fetchone()
return task
return result.fetchone()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TaskModel.load_task refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

@sourcery-ai

sourcery-ai Bot commented Aug 11, 2020

Copy link
Copy Markdown
Author

Sourcery Code Quality Report (beta)

✅  Merging this PR will increase code quality in the affected files by 0.02 out of 10.

Quality metrics Before After Change
Complexity 0.24 0.17 -0.07 🔵
Method Length 19.88 19.25 -0.63 🔵
Quality 9.48 9.50 0.02 🔵
Other metrics Before After Change
Lines 230 218 -12
Changed files Quality Before Quality After Quality Change
factory.py 9.16 9.43 0.27 🔵
qml_wrapper.py 9.60 9.61 0.01 🔵
models/idea.py 9.37 9.39 0.02 🔵
models/task.py 9.41 9.43 0.02 🔵

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Overall Recommendation

Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants