Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
LngDetectoR is a Python tool designed to analyze directories and detect the programming languages used within files. It generates a comprehensive report detailing the count of files, lines of code, and the percentage of each language present.
To install LngDetectoR, you can use pip:
pip install LngDetectoR
LngDetectoR can be utilized directly from the command line. Basic usage is as follows:
lngdetector --directory <path-to-directory>
--directory
: Specifies the directory to analyze. If not specified, it defaults to the current working directory.LngDetectoR can also be used within your Python scripts.
Example:
from lngdetector.detect import generate_report
# Generate a report for the specified directory
report = generate_report('/path/to/your/project')
# Display the report in a pretty table format
report.print_pretty_table()
# Retrieve data for a specific language
python_data = report.get_language_data('Python')
print(f"Python files: {python_data['count']}, lines of code: {python_data['lines']}")
When you run LngDetectoR, it generates a table with the detected languages, file counts, lines of code, and their percentage contributions. Here's an example of what the output might look like:
Total files: 50
Total lines of code: 1200
+------------+------------+---------------+------------+
| Language | File Count | Lines of Code | Percentage |
+------------+------------+---------------+------------+
| Python | 20 | 500 | 41.67% |
| JavaScript | 15 | 350 | 29.17% |
| HTML | 10 | 200 | 16.67% |
| CSS | 5 | 150 | 12.50% |
+------------+------------+---------------+------------+
Contributions, issues, and feature requests are welcome! Feel free to check the issues page for a list of proposed features (and known issues).
This project is licensed under the MIT License.
FAQs
A tool to detect programming languages in a directory.
We found that LngDetectoR demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.