profile
viewpoint

Instagram/IGListKit 11405

A data-driven UICollectionView framework for building fast and flexible lists.

Instagram/MonkeyType 3088

A system for Python that generates static type annotations by collecting runtime types

Instagram/ig-json-parser 1272

Fast JSON parser for java projects

Instagram/LibCST 549

A concrete syntax tree parser and serializer library for Python that preserves many aspects of Python's abstract syntax tree

Instagram/cassandra 389

Mirror of Apache Cassandra (incubating)

Instagram/Fixit 170

Fixit is a Python Lint Framework based on LibCST. It comes with useful default lint rules for coding convention, performance and security issues. It makes custom lint rule easy to build, test and configure. It empowers lint rule to provide autofix to fix the issues for developers. It also provide tools to run autofix across codebase to fix existing issues and automatically insert lint-fixme comments to silent existing violation. Fixit integrates with Flake8 and it adds the above mentioned enhancements to it.

Instagram/ultramemcached 25

Ultra fast memcached client writen in highly optimized C++ with Python bindings

Instagram/django 21

Official clone of the Subversion repository.

Instagram/geoip-api-python 20

GeoIP Python API

Instagram/redis-py 20

Redis Python Client

issue commentInstagram/LibCST

[BUG] Generated Code not equivalent to AST

@jimmylai Any chance to revisit this? It'd be great if we could discuss and agree on a proposal to fix this.

After looking deeper into how other syntactic elements are treated, I think we should also discuss whether parens should accept a MaybeSentinel as a default, or whether an empty sequence would always mean MaybeSentinel.

Also related to how some other elements are generated, another alternative is to check in the parent whether a child needs parentheses.

sk-

comment created time in 38 minutes

PullRequestReviewEvent

startedInstagram/IGListKit

started time in 5 hours

startedInstagram/Fixit

started time in 5 hours

startedInstagram/LibCST

started time in 7 hours

startedInstagram/LibCST

started time in 8 hours

startedInstagram/IGListKit

started time in 9 hours

startedInstagram/IGListKit

started time in 9 hours

pull request commentInstagram/Fixit

Add a rule to catch some incorrect uses of assertTrue()

@jimmylai, I believe the addition you suggest is out of scope for this rule.

The reasons:

  1. it looks for 1 arg calls to assertTrue() whereas all currently searched cases are 2 arg;
  2. it is more of a quality fix than correctness -- assertTrue(a == b) is still correct although the error message for assertEqual(a, b) is certainly better;
  3. there are more similar improvements possible that could be implemented in a future rule and @isidentical's teyit project is an awesome collection of those: assertTrue(a > b) --> assertGreater(), assertTrue(a in list) --> assertIn() etc.
kappa

comment created time in a day

IssuesEvent

issue commentInstagram/Fixit

Exception raised when running fixit on clean repository

That makes sense especially Pyre is not listed as required dependency of Fixit. Add a better suggestion at the end of the CLI run is a better user experience (instead of the current exception). Reopen to keep track this action item.

chdsbd

comment created time in a day

PullRequestReviewEvent

startedInstagram/MonkeyType

started time in a day

fork miss-bug/IGListKit

A data-driven UICollectionView framework for building fast and flexible lists.

https://instagram.github.io/IGListKit/

fork in a day

startedInstagram/MonkeyType

started time in a day

startedInstagram/IGListKit

started time in a day

startedInstagram/MonkeyType

started time in a day

pull request commentInstagram/Fixit

Add a rule to catch some incorrect uses of assertTrue()

@isidentical

If you'd like to implement a couple of more patterns, you can check out teyit. It is a tool where the only aim is formatting assertion calls like this, and I think it would be a great idea to slowly extract refactorings into fixit itself since it is a common place for all kinds of refactorings.

Thanks for the information on teyit! I really like the idea of making assertions use more specific methods. Correct me if I am wrong, but teyit tries to always keep the semantics of the tests unchanged. My pull request actually fixes incorrect tests. Some tests may start to fail after applying the fixes.

kappa

comment created time in a day

pull request commentInstagram/Fixit

Add a rule to catch some incorrect uses of assertTrue()

docs check failure should be fixed after #133.

kappa

comment created time in a day

pull request commentInstagram/Fixit

Add a rule to catch some incorrect uses of assertTrue()

If you'd like to implement a couple of more patterns, you can check out (teyit)[https://github.com/isidentical/teyit]. It is a tool where the only aim is formatting assertion calls like this, and I think it would be a great idea to slowly extract refactorings into fixit itself since it is a common place for all kinds of refactorings.

kappa

comment created time in a day

PR opened Instagram/Fixit

Add a rule to catch some incorrect uses of assertTrue()

assertTrue() calls with 2 arguments when the intention is clearly to compare the values are surprisingly common. This is valid syntax, but completely incorrect semantics as no comparison is done and the second argument is used as the assertion failure message.

See some examples: https://grep.app/search?q=self%5C.assertTrue%5C%28.%2B%2C%5Cs%2A%28%5B%2B-%5D%3F%280%5Bxb%5D%29%3F%5Cd%2B%28%5C.%5Cd%2B%29%3F%7CTrue%7C%5C%5B.%2A%5C%5D%29%5C%29%24&regexp=true&filter[lang][0]=Python

Some incorrect cases are not caught by this rule because there's no way to always reliably determine the role of the second argument. One example is: https://github.com/vibora-io/vibora/blob/master/tests/schemas/schemas.py#L18

Summary

Test Plan

+112 -0

0 comment

1 changed file

pr created time in a day

startedInstagram/Fixit

started time in a day

issue commentInstagram/Fixit

Exception raised when running fixit on clean repository

If you don't want to install Pyre, you can simply ignore the exception message. It's a suggestion, not an error.

Wouldn't it be more feasible (especially targeted for new users who have no idea about this, since most linters don't require additional type-checkers to start in that same environment) to ignore this errors, and just give a couple of warnings at the end.

Current:

Encountered exception <class 'Exception'> for the following paths:
./main.py
Running `pyre start` may solve the issue.
main.py:4:1
    E305: expected 2 blank lines after class or function definition, found 1

Found 1 reports in 1 files in 0.33 seconds.

IMHO a better:

main.py:4:1
    E305: expected 2 blank lines after class or function definition, found 1

-> Some rules were disabled since pyre is not found on the current environment
Found 1 reports in 1 files in 0.33 seconds.
chdsbd

comment created time in a day

fork kappa/Fixit

Fixit is a Python Lint Framework based on LibCST. It comes with useful default lint rules for coding convention, performance and security issues. It makes custom lint rule easy to build, test and configure. It empowers lint rule to provide autofix to fix the issues for developers. It also provide tools to run autofix across codebase to fix existing issues and automatically insert lint-fixme comments to silent existing violation. Fixit integrates with Flake8 and it adds the above mentioned enhancements to it.

fork in a day

issue openedInstagram/Fixit

"Edit on GitHub" links are broken

Readthedocs-hosted doc pages for individual rules all have links at the top right corner that are broken.

Example: https://fixit.readthedocs.io/en/latest/rules/NoAssertEqualsRule.html has a link to https://github.com/Instagram/Fixit/blob/master/docs/source/rules/NoAssertEqualsRule.rst which does not exist.

created time in a day

Pull request review commentInstagram/Fixit

Added --name argument

     "\n",     "Use fixit's cli to generate a skeleton of adding a new rule file::\n",     "\n",-    "    $ python -m fixit.cli.add_new_rule # Creates new_rule.py at fixit/rules/new_rule.py\n",-    "    $ python -m fixit.cli.add_new_rule --path fixit/rules/my_rule.py # Creates rule file at path specified\n",+    "    $ python -m fixit.cli.add_new_rule # Creates new.py at fixit/rules/new.py\n",+    "    $ python -m fixit.cli.add_new_rule --path fixit/rules/my_rule.py --name rule_name # Creates my_rule.py at path specified \n",     "\n",-    "This will generate a rule file used to create and add new rule to fixit module."+    "This will generate a rule file used to create and add new rule to fixit module. \n",+    "\n",+    "The `fixit.cli.add_new_rule` contains two argument, ``-path`` and ``--name``\n",+    "\n",+    "- ``--path`` is used to create rule file at path given in ``--path``, Default is ``fixit/rules/new.py``\n",+    "- ``--name`` is used to assign the name of the rule and should be in snake case, Default is name of the rule file if ``path`` provided else `new`. Otherwise, considers the value specified in ``--name``\n",

done

acharles7

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentInstagram/Fixit

Added --name argument

 def main() -> None:         "-p",         "--path",         type=is_path_exists,-        default=Path("fixit/rules/new_rule.py"),-        help="Path to add rule file, Default is fixit/rules/new_rule.py",+        default=Path("fixit/rules/new.py"),+        help="Path to add rule file, Default is fixit/rules/new.py",+    )++    parser.add_argument(+        "-n",+        "--name",+        type=str,+        default="",+        help="Name of the rule, Default is New",

done

acharles7

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent
more