CodeAnt AI home pagelight logodark logo
  • Support
  • Dashboard
  • Dashboard
  • Join Community
Start Here
  • What is CodeAnt?
Setup
  • Github
  • Bitbucket
  • Gitlab
  • Azure Devops
Pull Request Review
  • Features
  • Customize Review
  • Quality Gates
  • Integrations
Scan center
  • Code Security
  • Code Quality
  • Cloud Security
  • Engineering Productivity
Integrations
  • Jira
  • Test Coverage
  • CI/CD
IDE
  • Setup
  • Review
  • Enhancements
Rule Reference
  • Compliance
  • Anti-Patterns
  • Code Governance
  • Infrastructure Security Database
  • Application Security Database
    • Apex
    • Bash
    • C
    • Clojure
    • Cpp
    • Csharp
    • Dockerfile
    • Elixir
    • Fingerprints
    • Generic
    • Go
    • Html
    • Java
    • Javascript
    • Json
    • Kotlin
    • Ocaml
    • Php
    • Problem-based-packs
    • Python
      • Airflow
      • Attr
      • Aws-lambda
      • Bokeh
      • Boto3
      • Cassandra
      • Click
      • Correctness
      • Couchbase
      • Cryptography
      • Distributed
      • Django
      • Docker
      • Elasticsearch
      • Fastapi
      • Flask
      • Jinja2
      • Jwt
      • Lang
        • Best practice
        • Code
        • Compatibility
        • Correctness
        • Correctness
        • Deserialization
        • File
        • Hardcoded
        • Maintainability
        • Os
        • Security
        • Security
      • Ldap3
      • Mariadb
      • Mysql
      • Mysqlclient
      • Neo4j
      • Openai
      • Peewee
      • Pg8000
      • Psycopg2
      • Pycryptodome
      • Pyjwt
      • Pymongo
      • Pymssql
      • Pymysql
      • Pyramid
      • Redis
      • Requests
      • Sh
      • Sqlalchemy
      • Tormysql
      • Urllib3
      • Webrepl
      • Wtforms
    • Ruby
    • Rust
    • Scala
    • Solidity
    • Swift
    • Terraform
    • Typescript
    • Yaml
Resources
  • Open Source
  • Blogs
Lang

Correctness

pytest-assert_match-after-path-patch

snapshot.assert_match makes use of pathlib to create files. Patching $METHOD may result in unexpected snapshot behavior

sync-sleep-in-async-code

Synchronous time.sleep in async code will block the event loop and not allow other tasks to execute. Use asyncio.sleep() instead.

unchecked-subprocess-call

This is not checking the return value of this subprocess call; if it fails no exception will be raised. Consider subprocess.check_call() instead

baseclass-attribute-override

Class Cinheritsfromboth‘C inherits from both `Cinheritsfromboth‘AandB‘whichbothhaveamethodnamed‘B` which both have a method named `B‘whichbothhaveamethodnamed‘F`; one of these methods will be overwritten.

file-object-redefined-before-close

Detected a file object that is redefined and never closed. This could leak file descriptors and unnecessarily consume system resources.

uncaught-executor-exceptions

Values returned by thread pool map must be read in order to raise exceptions. Consider using for _ in $EXECUTOR.map(...): pass.

return-in-init

return should never appear inside a class init function. This will cause a runtime error.

yield-in-init

yield should never appear inside a class init function. This will cause a runtime error.

list-modify-while-iterate

It appears that $LIST is a list that is being modified while in a for loop. This will likely cause a runtime error or an infinite loop.

use-sys-exit

Detected use of exit. Use sys.exit over the python shell exit built-in. exit is a helper for the interactive shell and may not be available on all Python implementations.

writing-to-file-in-read-mode

The file object ‘$FD’ was opened in read mode, but is being written to. This will cause a runtime error.

no-strings-as-booleans

Using strings as booleans in Python has unexpected results. "one" and "two" will return “two”. "one" or "two" will return “one”. In Python, strings are truthy, and strings with a non-zero length evaluate to True.

test-is-missing-assert

Comparison without assertion. The result of this comparison is not used. Perhaps this expression is missing an assert keyword.

dict-del-while-iterate

It appears that $DICT[$KEY] is a dict with items being deleted while in a for loop. This is usually a bad idea and will likely lead to a RuntimeError: dictionary changed size during iteration

cannot-cache-generators

Generators can only be consumed once, so in most cases, caching them will cause an error when the already-consumed generator is retrieved from cache.

pdb-remove

pdb is an interactive debugging tool and you may have forgotten to remove it before committing your code

useless-eqeq

This expression is always True: $X == $X or $X != $X. If testing for floating point NaN, use math.isnan($X), or cmath.isnan($X) if the number is complex.
CompatibilityCommon mistakes
twitterlinkedin
Powered by Mintlify
Assistant
Responses are generated using AI and may contain mistakes.