Giter VIP home page Giter VIP logo

emailscript's People

Stargazers

 avatar

Watchers

 avatar

emailscript's Issues

Sweep: Add filters for forwarding emails

Add a configuration option per account as to an email address to forward emails from specific senders or containing specific subject lines. This is the reverse of the normal functionality, where emails from senders in annoying_senders or with subject lines matching against entries in annoying are simply deleted.

Checklist
  • account_setup.py

• Add a new optional input field for the forwarding email address. If provided, add this to the 'data' dictionary with the key 'forwarding_address'.

  • domail.py

• In the 'go' method, before the deletion functionality, add a new block of code to check if the email should be forwarded. This should check if the sender or subject line matches any entries in a new 'forwarding_senders' or 'forwarding_subjects' list (similar to 'annoying_senders' and 'annoying'). If a match is found, the email should be forwarded to the 'forwarding_address' specified in the account's TOML file and not deleted.
• Modify the deletion functionality to not delete emails that have been forwarded.

  • tests.py

• Add tests for the new forwarding functionality. These should cover various scenarios, including forwarding emails from specific senders, forwarding emails with specific subject lines, and forwarding emails that also match the deletion criteria.

  • forwarding_senders

• Create a new file 'forwarding_senders' to store the list of senders whose emails should be forwarded. This file should follow the same format as 'annoying_senders'.

  • forwarding_subjects

• Create a new file 'forwarding_subjects' to store the list of subject lines that should trigger an email to be forwarded. This file should follow the same format as 'annoying'.

Sweep: refactor files to satisfy pylint

Details

From GitHub actions, pylint outputted the following in regards to code formatting:

Run pylint $(git ls-files '*.py')
************* Module tests
tests.py:13:5: E0001: Parsing failed: 'expected an indented block after function definition on line 8 (<unknown>, line 13)' (syntax-error)
************* Module account_setup
account_setup.py:1[7](https://github.com/SomethingGeneric/emailscript/actions/runs/6075670035/job/16482319526#step:5:8):0: C0301: Line too long (10[8](https://github.com/SomethingGeneric/emailscript/actions/runs/6075670035/job/16482319526#step:5:9)/100) (line-too-long)
account_setup.py:1:0: C0114: Missing module docstring (missing-module-docstring)
account_setup.py:3:0: E0401: Unable to import 'toml' (import-error)
account_setup.py:8:4: R1723: Unnecessary "else" after "break", remove the "else" and de-indent the code inside it (no-else-break)
account_setup.py:20:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
account_setup.py:4:0: C0411: standard import "from getpass import getpass" should be placed before "import toml" (wrong-import-order)
************* Module domail
domail.py:114:0: C0304: Final newline missing (missing-final-newline)
domail.py:1:0: C0114: Missing module docstring (missing-module-docstring)
domail.py:2:0: E0401: Unable to import 'toml' (import-error)
domail.py:4:0: E0401: Unable to import 'imap_tools' (import-error)
domail.py:5:0: E0401: Unable to import 'discord_webhook' (import-error)
domail.py:8:0: C0115: Missing class docstring (missing-class-docstring)
domail.py:8:0: C0103: Class name "cope" doesn't conform to PascalCase naming style (invalid-name)
domail.py:13:31: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
domail.py:13:31: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
domail.py:15:24: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
domail.py:15:24: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
domail.py:16:32: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
domail.py:16:32: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
domail.py:18:4: C0116: Missing function or method docstring (missing-function-docstring)
domail.py:20:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
domail.py:20:48: C0103: Variable name "f" doesn't conform to snake_case naming style (invalid-name)
domail.py:28:4: C0116: Missing function or method docstring (missing-function-docstring)
domail.py:28:4: C0103: Method name "go" doesn't conform to snake_case naming style (invalid-name)
domail.py:28:4: R0[9](https://github.com/SomethingGeneric/emailscript/actions/runs/6075670035/job/16482319526#step:5:10)14: Too many local variables (16/15) (too-many-locals)
domail.py:30:12: C0[10](https://github.com/SomethingGeneric/emailscript/actions/runs/6075670035/job/16482319526#step:5:11)3: Variable name "f" doesn't conform to snake_case naming style (invalid-name)
domail.py:40:33: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
domail.py:40:33: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
domail.py:41:34: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
domail.py:41:34: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
domail.py:107:25: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
domail.py:108:21: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
domail.py:28:4: R0912: Too many branches (15/12) (too-many-branches)
************* Module main
main.py:[11](https://github.com/SomethingGeneric/emailscript/actions/runs/6075670035/job/16482319526#step:5:12):0: C0304: Final newline missing (missing-final-newline)
main.py:1:0: C01[14](https://github.com/SomethingGeneric/emailscript/actions/runs/6075670035/job/16482319526#step:5:15): Missing module docstring (missing-module-docstring)
main.py:1:0: C0[41](https://github.com/SomethingGeneric/emailscript/actions/runs/6075670035/job/16482319526#step:5:42)0: Multiple imports on one line (os, shutil) (multiple-imports)

-----------------------------------
Your code has been rated at 3.52/10

Please make these and any other adjustments to satisfy the linter

Sweep: Refactor for pep8 compliance

Details

Pylint complains that this function, starting on line 44 of domail.py, uses too many local variables. Please reduce them as much as possible. Specificaly, Pylint wants no more than 15 local variables in the function.

Checklist
  • domail.py

• Move the list of annoying phrases and senders to the class level. They can be defined in the __init__ method and used throughout the class.
• Create a new method forward_email that takes a message and a reason as parameters. Move the code that handles forwarding emails from the go function to this new method.
• Create a new method delete_email that takes a message and a reason as parameters. Move the code that handles deleting emails from the go function to this new method.
• Create a new method log_message that takes a message and a log message as parameters. Move the code that handles logging from the go function to this new method.
• In the go function, replace the code that handles forwarding, deleting, and logging emails with calls to the new methods.

Sweep: refactor domail.Cope.process

Details

Pylint complains that this function, starting on line 44 of domail.py, uses too many local variables. Please reduce them as much as possible. Specificaly, Pylint wants no more than 15 local variables in the function.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.