Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored main branch #66

Merged
merged 1 commit into from
Apr 13, 2021
Merged

Sourcery refactored main branch #66

merged 1 commit into from
Apr 13, 2021

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Apr 9, 2021

Branch main 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 main branch, then run:

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

@sourcery-ai sourcery-ai bot requested a review from vincentclaes April 9, 2021 06:57
Comment on lines -98 to +99
args = args if args else []
extra_args = extra_args if extra_args else []
args = args or []
extra_args = extra_args or []
Copy link
Author

Choose a reason for hiding this comment

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

Function call_cdk refactored with the following changes:

glue_job_role = iam.Role(
return iam.Role(
Copy link
Author

Choose a reason for hiding this comment

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

Function DataJobBase.get_role refactored with the following changes:

env = core.Environment(account=account, region=region)
return env
return core.Environment(account=account, region=region)
Copy link
Author

Choose a reason for hiding this comment

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

Function DataJobStack._create_environment_object refactored with the following changes:

self.arguments = arguments if arguments else {}
self.arguments = arguments or {}
Copy link
Author

Choose a reason for hiding this comment

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

Function GlueJob.__init__ refactored with the following changes:

if job_type == "pythonshell" or None:
if job_type == "pythonshell":
Copy link
Author

Choose a reason for hiding this comment

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

Function GlueJob._get_glue_version refactored with the following changes:

Comment on lines -198 to -203
s3_url_glue_job = GlueJob._create_s3_url_for_job(
return GlueJob._create_s3_url_for_job(
context=context,
glue_job_id=glue_job_name,
glue_job_file_name=glue_job_file_name,
)
return s3_url_glue_job
Copy link
Author

Choose a reason for hiding this comment

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

Function GlueJob._deploy_glue_job_code refactored with the following changes:

Comment on lines -57 to +64
if config_file_full_path.is_file():
logger.debug(f"found a {config_file} file in {project_root}")
call_subprocess(cmd=cmd)
else:
if not config_file_full_path.is_file():
raise DatajobPackageWheelError(
f"no {config_file} file detected in project root {project_root}. "
f"Hence we cannot create a python wheel for this project"
)

logger.debug(f"found a {config_file} file in {project_root}")
call_subprocess(cmd=cmd)
Copy link
Author

Choose a reason for hiding this comment

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

Function create_wheel._execute_packaging_logic refactored with the following changes:

status = description.get("status")
return status
return description.get("status")
Copy link
Author

Choose a reason for hiding this comment

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

Function _get_status refactored with the following changes:

Comment on lines -38 to +37
execution = workflow.execute()
return execution
return workflow.execute()
Copy link
Author

Choose a reason for hiding this comment

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

Function _execute refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Apr 9, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.02%.

Quality metrics Before After Change
Complexity 0.86 ⭐ 0.81 ⭐ -0.05 👍
Method Length 36.63 ⭐ 36.19 ⭐ -0.44 👍
Working memory 8.82 🙂 8.86 🙂 0.04 👎
Quality 79.51% 79.53% 0.02% 👍
Other metrics Before After Change
Lines 592 587 -5
Changed files Quality Before Quality After Quality Change
datajob/datajob.py 73.74% 🙂 73.79% 🙂 0.05% 👍
datajob/datajob_base.py 82.77% ⭐ 83.68% ⭐ 0.91% 👍
datajob/datajob_stack.py 86.42% ⭐ 86.50% ⭐ 0.08% 👍
datajob/glue/glue_job.py 74.51% 🙂 74.71% 🙂 0.20% 👍
datajob/package/wheel.py 85.62% ⭐ 86.01% ⭐ 0.39% 👍
datajob/stepfunctions/stepfunctions_execute.py 82.58% ⭐ 81.26% ⭐ -1.32% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
datajob/glue/glue_job.py GlueJob.__init__ 1 ⭐ 120 😞 18 ⛔ 54.53% 🙂 Try splitting into smaller methods. Extract out complex expressions
datajob/datajob.py deploy 1 ⭐ 91 🙂 22 ⛔ 55.90% 🙂 Extract out complex expressions
datajob/glue/glue_job.py GlueJob._create_glue_job 1 ⭐ 88 🙂 17 ⛔ 59.70% 🙂 Extract out complex expressions
datajob/datajob.py synthesize 0 ⭐ 65 🙂 18 ⛔ 63.27% 🙂 Extract out complex expressions
datajob/datajob.py destroy 0 ⭐ 65 🙂 18 ⛔ 63.27% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


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.

@vincentclaes vincentclaes merged commit 343778a into main Apr 13, 2021
@vincentclaes vincentclaes deleted the sourcery/main branch June 23, 2021 08:23
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.

None yet

1 participant