Skip to content

Commit

Permalink
Merge pull request #40 from adambullmer/pipenv
Browse files Browse the repository at this point in the history
Pipenv
  • Loading branch information
adambullmer authored Dec 9, 2018
2 parents e71aabf + 2746fd4 commit ef6a6ad
Show file tree
Hide file tree
Showing 29 changed files with 467 additions and 55 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit =
*/__main__.py
tests/*
__init__.py
File renamed without changes.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.tox
*.sublime-package
pytest
.coverage
2 changes: 1 addition & 1 deletion DocblockrPython.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def plugin_loaded():
"""The Sublime Text 3 entry point for plugins."""
"""Sublime Text 3 entry point for plugins."""
populate_registry()

global plugin_is_loaded
Expand Down
17 changes: 17 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
tox = "*"
flake8 = "*"
pytest = "*"
pytest-cov = "*"
pytest-sugar = "*"
pydocstyle = "*"

[packages]

[requires]
python_version = "3.4.3"
243 changes: 243 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,53 @@ class MyFormatter(Base):
**Note:** The console should yell at you if you didn't write all the abstract methods. Be sure to read the docs on the `Base` formatter
to make sure you understand all the caveats of each formatter function.

Local Development
-----------------

Below are the instructions to work on this repo locally.

1. Clone the repo.
1. Uninstall the plugin from sublime text.
1. Symlink the github repo into your sublime text packages directory.
- Debian example:
```bash
ln -s <absolute/path/to/github/repo/sublime_docblockr_python> $HOME/.config/sublime-text-3/Packages/Docblockr_Python
```
1. There are no runtime dependencies
1. Pay attention to the sublime console ```ctrl + ` ```


Testing Changes
---------------

In addition to the setup instructions above, testing will require additinoal setup.

**System Requirements:**
- [pyenv](https://github.com/pyenv/pyenv)
- [pipenv](https://pipenv.readthedocs.io/en/latest/)

**Setup:**
1. Install depedencies through pipenv `pipenv install --dev`
1. Run unit tests `pipenv run tox`
- [py.test](https://docs.pytest.org/en/latest/) unit tests
- [flake8](http://flake8.pycqa.org/en/latest/) linting
- [pydocstyle](http://www.pydocstyle.org/en/2.1.1/) (formerly PEP257) docstring checker


Known Issues
------------
- Only detects closed docstring if it is on a line of the same indentation, and has no text in front of it. Single Line docstrings are converted to block
- The tests run in python `3.4.3`, however sublime's python version is `3.3.6`. This is due to the difficulty of getting a working version of 3.3.6 in a dev environment, and the differences should be minimal.


Roadmap
-------
Things I want to do wtih this project. Not necessarily an exhaustive or prioritized list.

- Unit Tests!
- Needs a test harness of some sort for sublime internals.
- CI, probably circleci
- Coverage reporting
- More completions!
- Javadoc style formatter
- Keyboard Shortcuts
Expand Down
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Docblockr Python."""
4 changes: 3 additions & 1 deletion commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def escape(string):
Returns:
{String} String with escaped characters
"""
return string.replace('$', r'\$').replace('{', r'\{').replace('}', r'\}')

Expand Down Expand Up @@ -101,7 +102,7 @@ def run(self, edit):
write(self.view, snippet)

def initialize(self, view):
"""Setup the command's settings.
"""Set up the command's settings.
Begins preparsing the file to gather some basic information.
- Which parser to use
Expand Down Expand Up @@ -141,6 +142,7 @@ def create_snippet(self, parsed_attributes):
Returns:
str -- sublime text formatted snippet string
"""
project_formatter = self.project_settings.get('formatter', None)
formatter = get_formatter(project_formatter or get_setting('formatter'))()
Expand Down
4 changes: 3 additions & 1 deletion parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ def process_variable(self, variable, hints=None):
params['default'] = pieces[1].strip()

params['name'] = variable
params['type'] = hints.get(variable, None) or guess_type_from_value(params.get('default')) or guess_type_from_name(variable)
params['type'] = hints.get(variable, None) or \
guess_type_from_value(params.get('default')) or \
guess_type_from_name(variable)

return params

Expand Down
Loading

0 comments on commit ef6a6ad

Please sign in to comment.