Skip to content

Improve make and reformat files#356

Merged
20001LastOrder merged 8 commits intoAggregate-Intellect:mainfrom
oshoma:improve-make-and-format
May 6, 2024
Merged

Improve make and reformat files#356
20001LastOrder merged 8 commits intoAggregate-Intellect:mainfrom
oshoma:improve-make-and-format

Conversation

@oshoma
Copy link
Copy Markdown
Collaborator

@oshoma oshoma commented May 2, 2024

Description

Improve the Makefile by adding capabilities to lint, format and test.

We get a more robust set of make commands, including:

  • more comprehensive make lint
  • expanded code coverage in make test
  • make test fails if coverage drops below 75%

This PR creates a separate makefile for the Slackapp. When we run make commands in src/sherpa we are just touching the sherpa_ai package, and when we run make commands in src/apps/slackapp we are just touching the Slackapp package.

The changes to files other than the makefile are all cosmetic, including removing
superfluous whitespace and adding lint directives. There are no logic changes.
Most of the changes are just reformatting from running make format in ff3848e. It is easiest to review that single commit on its own, then review the remaining changes.

This is another step towards CI/CD. Once we are confident this is working nicely we can change
our github workflow to use make test and possibly make lint.

Run poetry self update && poetry install to pick up these changes.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

Closes #343. (this PR replaces it.)
Tracked in SHR-45.

Checklists

To speed up the review process, please follow these checklists:

Development

  • The Pull Request is small and focused on one topic
  • Lint rules pass locally (make format && make lint)
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development (make test)
  • The changes generate no new warnings (or explain any new warnings and why they're ok)
  • Commit messages are detailed
  • Changed code is self-explanatory and/or I added comments
  • I updated the documentation (docstrings, /docs)
    See the testing guidelines for help on tests, especially those involving web services.

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached.
  • I have performed a self-review of my code
  • Issue from task tracker has a link to this pull request

💔 Thank you for submitting a pull request!

oshoma added 8 commits May 2, 2024 11:09
Run `poetry self update && poetry install` after picking up this commit.

Changes:
- Change all make steps to depend on poetry being installed
- Add mypy for static type checking, but leave disabled for now
- Use more sophisticated lint options
- Include Slack app in `make test`
- Include Slack tests in `make lint`
- Fail tests if coverage drops below 75%

mypy gives us static type checking. It triggers many warnings,
so I am disabling mypy for now and will create an issue to resolve
mypy warnings.
Change code to resolve these lint warnings:
- F821: Undefined names
- F841: Local variable name is assigned to but never used
- F811: Redefinition of unused name from line name
Change code to resolve these warnings:
- F811: Redefinition of unused name from line name
- W291: Trailing whitespace

`make lint` will now warn and fail if files contain trailing whitespace.
flake8 is currently configured to ignore these errors:
W503: Line break occurred before a binary operator
E501: Line too long (82 > 79 characters)
E402: Module level import not at top of file

This change makes the behavior consistent for both
`make lint` and `poetry run flake8`.

Also removing E402 as that warning was already resolved.
Create a Makefile just for Slackapp so we can run `make test` within
/sherpa/src/apps/slackapp using Slackapp's own Poetry environment.

Remove knowledge of Slackapp from Sherpa's makefile.

Change make to install Spacy model dependency.
Copy link
Copy Markdown
Collaborator

@20001LastOrder 20001LastOrder left a comment

Choose a reason for hiding this comment

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

LGTM

@20001LastOrder 20001LastOrder merged commit 44b53bb into Aggregate-Intellect:main May 6, 2024
@oshoma oshoma deleted the improve-make-and-format branch May 6, 2024 20:55
Seti17 pushed a commit to Seti17/sherpa that referenced this pull request Apr 9, 2025
…nd-format

Improve make and reformat files
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