Skip to content
/ xlines Public

Counts number of lines of code in a project (python3 implementation)

License

Notifications You must be signed in to change notification settings

fstab50/xlines

Repository files navigation


xlines


Summary

Count the number of lines of text in a code project (or anything else)

Version: 0.7.21


Contents

--

back to the top


Dependencies

xlines requires Python 3.6+.

If your environment has Python 3.5 or older or is missing Python 3 altogether, consider using nlines as an excellent alternative. nlines bash implementation line counter is compatible with virtually any Linux-based development environment.

back to the top


Program Options

To display the xlines help menu:

    $ xlines --help

--

back to the top


Build options

GNU Make Targets. Type the following to display the available make targets from the root of the project:

    $  make help

--

back to the top


Configuration

Configure xlines runtime options by entering the configuration menu:

    $ xlines --configure

toc 

back to the top

--

Option "A" (shown below) allows addition of file types to be excluded (skipped) from line totals

option a

back to the top

--

Option "B" (shown below) allows deletion of file types from the exclusion list so that a specific file extension will be included in total line counts:

option b 

back to the top

--

Option "C" (shown below) allows user-customization of files highlighted for containing a large number of lines of text:

option c

--

back to the top


Installation


Pip Install

xlines may be installed on Linux via pip, python package installer in one of two methods:

To install xlines for a single user:

$  pip3 install xlines --user

To install xlines for all users (Linux):

$  sudo -H pip3 install xlines

back to the top


Ubuntu, Linux Mint, Debian variants (Python 3.6, 3.7)

The easiest way to install xlines on debian-based Linux distributions is via the debian-tools package repository:

  1. Open a command line terminal.

    deb-install0

  2. Download and install the repository definition file

    $ sudo apt install wget
    
    $ wget http://awscloud.center/deb/debian-tools.list
    

    deb-install1

    $ sudo chown 0:0 debian-tools.list && sudo mv debian-tools.list /etc/apt/sources.list.d/
    
  3. Install the package repository public key on your local machine

    $ wget -qO - http://awscloud.center/keys/public.key | sudo apt-key add -
    

    deb-install2

  4. Update the local package repository cache

    $ sudo apt update
    
  5. Install xlines os package

    $ sudo apt install python3-xlines
    

    Answer "y":

    deb-install3

  6. Verify Installation

    $ apt show python3-xlines
    

    rpm-install4

back to the top


Redhat, CentOS (Python 3.6)

The easiest way to install xlines on redhat-based Linux distributions is via the developer-tools package repository:

  1. Open a command line terminal.

    rpm-install0

  2. Install the official epel package repository

    $ sudo yum install epel-release
    
  3. Download and install the repo definition file

    $ sudo yum install wget
    

    rpm-install1

    $ wget http://awscloud.center/rpm/developer-tools.repo
    

    rpm-install2

    $ sudo chown 0:0 developer-tools.repo && sudo mv developer-tools.repo /etc/yum.repos.d/
    
  4. Delete the local repository cache, then Update the cache with new package references

    $ sudo rm -fr /var/cache/yum
    $ sudo yum update -y
    
  5. Install the python3-xlines os package

    $ sudo yum install python36-xlines
    

    rpm-install3

    Answer "y":

    rpm-install4

  6. Verify Installation

    $ yum info python36-xlines
    

    rpm-install5

back to the top


Amazon Linux 2 / Fedora (Python 3.7)

The easiest way to install xlines on redhat-based Linux distribution Amazon Linux 2 or Fedora, is via the developer-tools amzn2.awscloud.center package repository:

  1. Install the official epel package repository

    $ sudo amazon-linux-extras install epel -y
    
  2. Download and install the repo definition file

    $ sudo yum install wget
    

    amzn2-install1

    $ wget http://awscloud.center/amzn2/developer-tools.repo
    

    amzn2-install2

    $ sudo chown 0:0 developer-tools.repo && sudo mv developer-tools.repo /etc/yum.repos.d/
    
  3. Delete the local repository cache, then Update the cache with new package references

    $ sudo rm -fr /var/cache/yum
    $ sudo yum update -y
    
  4. Install xlines os package

    $ sudo yum install python37-xlines
    

    amzn2-install3

    Answer "y":

    amzn2-install4

  5. Verify Installation

    $ yum info python37-xlines
    

    rpm-install5

    A check of python3 should point to Python 3.7:

    $ python3 --version
    
    $ Python 3.7.X
    

--

back to the top


Screenshots

Project 1: Line count, low complexity git repository:

    $ xlines  --sum  git/branchdiff

back to the top


Project 2: Line count, medium complexity git repository:

back to the top


Project 3: Line count, high complexity git repository:

back to the top


Author & Copyright

All works contained herein copyrighted via below author unless work is explicitly noted by an alternate author.

  • Copyright Blake Huber, All Rights Reserved.

back to the top


License

  • Software contained in this repo is licensed under the license agreement. You may display the license and copyright information by issuing the following command:
$ xlines --version

help

back to the top


Disclaimer

Code is provided "as is". No liability is assumed by either the code's originating author nor this repo's owner for their use at AWS or any other facility. Furthermore, running function code at AWS may incur monetary charges; in some cases, charges may be substantial. Charges are the sole responsibility of the account holder executing code obtained from this library.

Additional terms may be found in the complete license agreement.

back to the top