generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 27
Add compliant and noncompliant examples of python/notebook-best-practice-violation@v1.0 #61
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
Open
ankit-amazon
wants to merge
5
commits into
aws-samples:main
Choose a base branch
from
ankit-amazon:notebook-best-practice-violation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5a913c3
Add compliant and noncompliant examples of python/notebook-best-pract…
ankit-amazon 94a6652
Improve compliant and noncompliant examples for python/notebook-best-…
ankit-amazon b3890d2
Update notebook_best_practice_violation_noncompliant.ipynb
ankit-amazon e4b6ee8
Remove ipynb and add py files for python/notebook-best-practice-viola…
ankit-amazon f9cd390
Update notebook_best_practice_violation.py
ankit-amazon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
src/python/detectors/notebook_best_practice_violation/notebook_best_practice_violation.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # {fact rule=notebook-best-practice-violation@v1.0 defects=1} | ||
| # —— Code Cell 1, Execution Count 1 —— # | ||
| import numpy as np | ||
| # —— Code Cell 2, Execution Count 2 —— # | ||
| # Noncompliant: imports are not in the first code cell. | ||
| import pandas as pd | ||
| primary = pd.read_csv('attribute-primary-info.csv', sep='\t') | ||
| primary | ||
| # —— Code Cell 3, Execution Count 3 —— # | ||
| alias = pd.read_csv('attribute-alias-info-en_US.csv', sep='\t') | ||
| alias | ||
| # —— Code Cell 4, Execution Count 4 —— # | ||
| # Noncompliant: blank cells. | ||
| # —— Code Cell 5, Execution Count 5 —— # | ||
|
|
||
| # —— Code Cell 6, Execution Count 6 —— # | ||
|
|
||
| # —— Code Cell 7, Execution Count 7 —— # | ||
|
|
||
| # —— Code Cell 8, Execution Count 8 —— # | ||
|
|
||
| # —— Code Cell 9, Execution Count 9 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 10, Execution Count 10 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 11, Execution Count 11 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 12, Execution Count 12 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 13, Execution Count 13 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 14, Execution Count 14 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 15, Execution Count 15 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 16, Execution Count 16 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 17, Execution Count 17 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 18, Execution Count 18 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 19, Execution Count 19 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 20, Execution Count 20 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 21, Execution Count 21 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 22, Execution Count 22 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 23, Execution Count 23 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 24, Execution Count 24 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 25, Execution Count 25 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 26, Execution Count 26 —— # | ||
| print('Hello World!') | ||
| # —— Code Cell 27, Execution Count 27 —— # | ||
| # Noncompliant: too many code cells. | ||
| print('Hello World!') | ||
| # —— Code Cell 28, Execution Count 28 —— # | ||
| # —— Code Cell 29, Execution Count 29 —— # | ||
| # —— Code Cell 30, Execution Count 30 —— # | ||
| # {/fact} | ||
|
|
||
|
|
||
| # {fact rule=notebook-best-practice-violation@v1.0 defects=0} | ||
| # —— Code Cell 1, Execution Count 1 —— # | ||
| # Compliant: cell is not blank. Imports are in place. | ||
| # Cell limit is not exceeding. | ||
| import numpy as np | ||
| import pandas as pd | ||
| # —— Code Cell 2, Execution Count 2 —— # | ||
| primary = pd.read_csv('attribute-primary-info.csv', sep='\t') | ||
| primary | ||
| # —— Code Cell 3, Execution Count 3 —— # | ||
| alias = pd.read_csv('attribute-alias-info-en_US.csv', sep='\t') | ||
| alias | ||
| # {/fact} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, remove all Execution Count, as this information is not needed
Write this.
# —— Code Cell 1—— #There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved.