Skip to content

A simple Python script to analyze code files for lines, comments, and function metrics

Notifications You must be signed in to change notification settings

oNk2r/python-code-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

python-code-analyzer

A simple Python script to analyze code files for lines, comments, and function metrics

A beginner-friendly Python tool to analyze .py files.

Features:

  • Counts total lines of code
  • Counts number of comment lines
  • Detects functions
  • Calculates comment-to-code ratio
  • Finds the longest function by line count

Usage

python analyzer.py sample_code.py

Sample Output

Analyzing: sample_code.py
Total lines: 12
Comment lines: 2
Number of functions: 2
Code to comment ratio: 16.67%
Longest function: long_function (6 lines)

About

A simple Python script to analyze code files for lines, comments, and function metrics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages