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

More linting. Ignore ESP file. Clean redundancy in CI. #78

Merged
merged 4 commits into from
May 14, 2024
Merged

Conversation

danyoungday
Copy link
Collaborator

Simple linting PR to ensure we pass the linting check in the CI. Was passing locally before because I have ESP installed but the CI can't install it.

@danyoungday danyoungday requested a review from ofrancon April 2, 2024 16:40
@danyoungday danyoungday self-assigned this Apr 2, 2024
@@ -30,7 +30,7 @@ jobs:
pip install pylint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with PyLint
run: pylint --ignore="demo" --recursive=y --fail-under=9 ./*
run: pylint ./*
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't need these flags because they're specified in pylintrc now


recursive=y

fail-under=9.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved flags from eluc.yml into here. Now we ignore the esp directory because it can't be installed in the Github environment

Copy link
Member

Choose a reason for hiding this comment

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

Your code has been rated at 9.38/10

Next, we should raise the bar to 10 and fix the warnings.

good-names=X_train, X_val, X_test, y_train, y_val, y_test, X, Y, y, X_test_scaled, df, da, ds, i, n
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added some common "ok" names that break pylint convention

@@ -23,7 +23,7 @@ BLUE simulations with committed emissions could be used to estimate the long-ter
"Committed emissions" means all the emissions that are caused by a land-use change event are attributed to the year
of the event.
BLUE (bookkeeping of land use emissions) is a bookkeeping model that attributes carbon fluxes to land use activities.
See [BLUE: Bookkeeping of land use emissions](https://doi.org/10.1002/2014GB004997) for more details.
See [BLUE: Bookkeeping of Land Use Emissions](https://doi.org/10.1002/2014GB004997) for more details.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tried and failed to fix a weird error: README.md:26:74: E0001: Parsing failed: 'invalid decimal literal (, line 26)' (syntax-error)

Copy link
Member

Choose a reason for hiding this comment

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

Not sure why pylint evaluating README.md. We can probably ignore these files with:

ignore-patterns=*.md

That can investigate when we fix the warnings

@@ -64,7 +64,7 @@ def calculate_crowding_distance(front):
n_objectives = len(front[0].metrics)
distances = [0 for _ in range(len(front))]
for m in range(n_objectives):
front.sort(key=lambda c: c.metrics[m])
front.sort(key=lambda cand: cand.metrics[m])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed all of these to make it more clear c is a candidate

Copy link
Member

Choose a reason for hiding this comment

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

you could go as far as calling cand candidate. That will more more readable and we can afford the extra letters

Copy link
Member

@ofrancon ofrancon left a comment

Choose a reason for hiding this comment

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

lgtm


recursive=y

fail-under=9.0
Copy link
Member

Choose a reason for hiding this comment

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

Your code has been rated at 9.38/10

Next, we should raise the bar to 10 and fix the warnings.

@@ -23,7 +23,7 @@ BLUE simulations with committed emissions could be used to estimate the long-ter
"Committed emissions" means all the emissions that are caused by a land-use change event are attributed to the year
of the event.
BLUE (bookkeeping of land use emissions) is a bookkeeping model that attributes carbon fluxes to land use activities.
See [BLUE: Bookkeeping of land use emissions](https://doi.org/10.1002/2014GB004997) for more details.
See [BLUE: Bookkeeping of Land Use Emissions](https://doi.org/10.1002/2014GB004997) for more details.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why pylint evaluating README.md. We can probably ignore these files with:

ignore-patterns=*.md

That can investigate when we fix the warnings

@@ -64,7 +64,7 @@ def calculate_crowding_distance(front):
n_objectives = len(front[0].metrics)
distances = [0 for _ in range(len(front))]
for m in range(n_objectives):
front.sort(key=lambda c: c.metrics[m])
front.sort(key=lambda cand: cand.metrics[m])
Copy link
Member

Choose a reason for hiding this comment

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

you could go as far as calling cand candidate. That will more more readable and we can afford the extra letters

@@ -64,7 +64,7 @@ def calculate_crowding_distance(front):
n_objectives = len(front[0].metrics)
distances = [0 for _ in range(len(front))]
for m in range(n_objectives):
front.sort(key=lambda c: c.metrics[m])
front.sort(key=lambda candidate: candidate.metrics[m])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

c to candidate

@@ -43,7 +43,7 @@ def __init__(self, in_size: int, hidden_size: int, out_size: int,
self.parents = parents

@classmethod
def from_crossover(cls, parent1, parent2, p_mutation: float, gen: int, cand_id: int):
def from_crossover(cls, parent1, parent2, p_mutation: float, gen: int, cand_id: int) -> "Candidate":
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

class method returns itself

@danyoungday danyoungday merged commit ef4bdaf into main May 14, 2024
1 check passed
@danyoungday danyoungday deleted the lint branch May 14, 2024 17:44
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.

2 participants