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

Implement Class Docstrings as per Issue #5 #67 #68

Merged
merged 24 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b66546f
Write skeleton code for classes.py
AshirGuptash Apr 20, 2021
21c23ef
Black formatting commit
AshirGuptash Apr 23, 2021
c41580b
Finished initial implementation of ClassBuilder class
AshirGuptash Apr 23, 2021
ae9e5b2
add --test flag for test suite and debugging purposes
AshirGuptash Apr 24, 2021
5833718
Add ClassBuilder test suite
AshirGuptash Apr 24, 2021
8bdf89e
move test_classes.py to tests/ folder
AshirGuptash Apr 24, 2021
4861eef
removed experimental test files
AshirGuptash Apr 24, 2021
82a55e3
remove experimental test files
AshirGuptash Apr 24, 2021
c1f8fe7
Merge branch 'master' of https://github.com/calkerns/dyc
AshirGuptash Apr 24, 2021
a1bf959
Black style fix
AshirGuptash Apr 24, 2021
d1b76d7
move automated class testing files and rename them
AshirGuptash Apr 24, 2021
94b1faf
move around test files for consistency
AshirGuptash Apr 24, 2021
7068673
Merge remote-tracking branch 'upstream/master'
AshirGuptash Apr 24, 2021
78ddb17
fix classes testing suite
AshirGuptash Apr 24, 2021
d7aa09a
Add message to test script
AshirGuptash Apr 24, 2021
52bf791
Change --test flag to --skip-confirm for clarity
AshirGuptash Apr 24, 2021
3a27102
Remove unnecessary default options
AshirGuptash Apr 24, 2021
56cf7fb
Update README to include class options
AshirGuptash Apr 24, 2021
7552ac7
Update contributors list
AshirGuptash Apr 24, 2021
1e9d474
change file directory level
AshirGuptash Apr 25, 2021
f9b4ba1
module fix
AshirGuptash Apr 25, 2021
f59a562
Streamline test cases. Repurpose automated_class_tests folder into Py…
AshirGuptash Apr 26, 2021
0b13761
Remove in progress test case, possibly revisit as part of issue #2
AshirGuptash Apr 26, 2021
ddc35e6
fix Black style
AshirGuptash Apr 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
* [RCristiano](https://github.com/RCristiano)
* [Hildebrando Pedroni](https://github.com/HildePedroni)
* [Saran Balaji](https://github.com/csaranbalaji)
* [Ashir Gupta](https://github.com/AshirGuptash)
* [Calvin Kerns](https://github.com/calkerns)
44 changes: 40 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ To run on a Git Diff patch. Run
$ dyc diff
```


To have Docstrings prepended on a method while development.
Run the following command
```sh
$ dyc diff --watch
```

In order to bypass the text editor pop-up in the confirmation stage. Run
```sh
$ dyc start --skip-confirm
```
## Method Docstring Options

*You can also Setup your own customized Docstring Method Formatting in `dyc.yaml` within `formats` key*
Expand Down Expand Up @@ -93,15 +96,47 @@ $ dyc diff --watch
| `ignore` | Arguments to ignore. | list |
| `prefix` | A prefix like "@param". | str |

<br/>

## Classes Docstring Options

// TODO
*You can also Setup your own customized Docstring Class Formatting in `dyc.yaml` within `formats` key*


*Class*

| Key | Description | Type |
|:-----------------------: |:-----------------------------------------------------------------------------------------------------------------------: |------|
| `keywords` | The necessary keyword to search for in a line that triggers actions (default = ["class"]) | list |
| `enabled` | Determine if formatting is enabled for the extension | bool |
| `indent` | Indentation in a class. Limited options ['tab', '2 spaces', '4 spaces'] | str |
| `indent_content` | Confirm if the content of a docstring has to be indented as well | bool |
| `open` | Starting opener text of a method | str |
| `close` | Close text of a class. This could be the same as opened, but not all languages opening and closing docstrings are same | str |
| `comments` | Comments symbols | str |
| `break_after_open` | Do we add a new line after adding the open strings of a class? | bool |
| `break_after_docstring` | Do we add a new line after adding the docstring? | bool |
| `break_before_close` | Add a new line before closing docstrings on a class | bool |
| `words_per_line` | How many words do we add per docstring? | int |
| `within_scope` | Should the docstring be within the scope of the class or out? Just like JS Method docstrings | bool |


*Parents*

| Key | Description | Type |
|:-----------: |:---------------------------------------------: |:----: |
| `title` | A title for arguments. i.e: "Inheritance" | str |
| `underline` | Underline the title | bool |
| `inline` | Add docstrings all inline or break within. | bool |
| `prefix` | A prefix like "@parent". | str |

<br/>

## Top of file Options

// TODO

### Example
## Example

```sh
$ cd myapp/
Expand Down Expand Up @@ -260,6 +295,8 @@ def hello(name):

## Development

### Setup

Thank you for taking the time to contribute into this project. It is simple but could be really helpful moving forward to all developers.

To get started.
Expand All @@ -273,7 +310,6 @@ To get started.
$ pip install --editable .
```


Before commiting:

Install the pre-commit hooks
Expand Down
5 changes: 3 additions & 2 deletions dyc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@


class Builder(object):
def __init__(self, filename, config, placeholders=False):
def __init__(self, filename, config, placeholders=False, skip_confirm=False):
self.filename = filename
self.config = config
self.placeholders = placeholders
self.skip_confirm = skip_confirm

details = dict()

Expand All @@ -35,7 +36,7 @@ def initialize(self, change=None):
word.lstrip() for word in line.split(" ") if word.lstrip() in keywords
]
found = len(foundList) > 0 and not is_comment(
line, self.config.get('comments')
line, self.config.get("comments")
)
# Checking an unusual format in method declaration
if foundList:
Expand Down
Loading