Giter Club home page Giter Club logo

topy's People

Contributors

alex avatar berendt avatar debuiteb avatar intgr avatar ocaballeror avatar ssbarnea avatar theanalyst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

topy's Issues

UTF-8

write encoding is not specified on "--apply" .
I guess f.write encoding should match to f.read :

   if opts.apply:
       log.info("Writing %s", safe_name)
       with open(filename, 'w', encoding='utf-8') as f:
           f.write(text)

Add option to exclude directories or files explicitly

Provide an option to explicitly exclude certain directories or files.

For example, with the structure:

project
|    README.md
|    somefile.txt
|___ first-dir
     |    file-to-check.txt    
     |    other-typo-file.txt
     |
     |___ exclude-dir
          | ...

If I want to search for typos in all the files in first-dir except for anything in exlude-dir, I would like to do something like
topy --exclude exclude-dir root-dir

Could this option be added to provide a little more flexibility with the tool? Thanks

error "pkg_resources.DistributionNotFound: beautifulsoup4" when trying to run topy

I have installed topy and I keep getting the following error when I try to run "topy.exe c:\temp\typos.txt":

c:\PythonPortable\App\Scripts>topy.exe c:\temp\typos.txt
Traceback (most recent call last):
  File "c:\PythonPortable\App\Scripts\topy-script.py", line 5, in <module>
    from pkg_resources import load_entry_point
  File "c:\PythonPortable\App\lib\site-packages\pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "c:\PythonPortable\App\lib\site-packages\pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "c:\PythonPortable\App\lib\site-packages\pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: beautifulsoup4

I tried on Linux too and got the same error.

Upload to PyPI

This will make it easier to install and use for Python folks.

UnicodeDecodeError when running in a directory with a non-ascii filename

(topy) /t/x $ tree
.
└── �\230\203.md

0 directories, 1 file
(topy) /t/x $ topy -a .
/Users/alex_gaynor/.virtualenvs/topy/lib/python2.7/site-packages/bs4/__init__.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

To get rid of this warning, change this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "html.parser")

  markup_type=markup_type))
Loaded 3619 rules (except 0 errors, 45 disabled)
Traceback (most recent call last):
  File "/Users/alex_gaynor/.virtualenvs/topy/bin/topy", line 11, in <module>
    sys.exit(main())
  File "/Users/alex_gaynor/.virtualenvs/topy/lib/python2.7/site-packages/topy/topy.py", line 202, in main
    for filename in flatten_files(paths):
  File "/Users/alex_gaynor/.virtualenvs/topy/lib/python2.7/site-packages/topy/topy.py", line 158, in flatten_files
    for filename in walk_dir_tree(path):
  File "/Users/alex_gaynor/.virtualenvs/topy/lib/python2.7/site-packages/topy/topy.py", line 148, in walk_dir_tree
    if not f.startswith("."):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

rules exceptions not possible or undocumented

I have a very simple use case where topy fails on a YAML file by trying to add case:

- foo/jordan

Topy would rename jordan to Jordan, which will break the code as this is a filename.

Few problems related to this:

  • topy does not mention which rules was used in this case
  • topy has no command line parameter to enable more verbose mode (ex. to identify the rule used)
  • no option to disable topy or rule per specific line, file or repository.

No examples in the docs

There is not a single example of usage in the README. I created a file with some text with typos:

# test.txt
Hellp, my name is not rekevant.

Then I ran the command as specified but got nothing.

$ topy test.txt
Loaded 3729 rules (except 0 errors, 44 disabled)

Did it work but couldn't find any typos? Or am I doing something wrong and it didn't run properly?

Add string input

Add a flag or an option to do something similar to -

cat f | typo -s > new_file
typo -s <string> > new_file
use case -

  1. Want to create a new file and not to override existing one
  2. Get input from user and output it.

Speed up ruleset parsing

Parsing the ruleset tag soup file with BeautifulSoup4 can consume half a second at every startup; see issue #5.

add caching

Loading the regs everytime doesn't make sense.

Bad rules (false positives)

Just keeping a list of known false positives for personal reference. Feel free to add comments here.

Topy replaces:

  • attribtue -> attributue - both are incorrect :)
  • 2014-11-01T12:00 -> 2014 and 2011-01T12:00
  • From then on it's just like any exception -> From then on its just like any exception

Make the script take command line arguments

This is somewhat related to #3, we can make the script run over entire directory or a specific file. Also the need for update.sh can be removed as it can be made just a function in the file

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.