CodeLine Counter

 import os
from flask import Flask, request, jsonify, redirect, url_for
from werkzeug.utils import secure_filename
import tempfile
import zipfile
import io
import logging

app = Flask(__name__)

logging.basicConfig(level=logging.DEBUG)

SUPPORTED_EXTENSIONS = {'py', 'html', 'js', 'jsx', 'ts', 'css', 'txt', 'json'}

# Global variable to store the results
results_data = {
    'files_processed': {},
    'files_skipped': [],
    'total_lines': 0
}

def allowed_file(filename):
    return '.' in filename and \
           filename.rsplit('.', 1)[1].lower() in SUPPORTED_EXTENSIONS

About this template

This application processes zip files and displays code file details in a visually appealing table format.

Introduction to the CodeLine Counter Template

Welcome to the CodeLine Counter template! This template is designed to help you quickly set up an application that processes zip files containing code files and displays the details of each file, including the number of lines of code, in a visually appealing table format. This is an excellent tool for builders who need to analyze the volume of code in a project or for educational purposes.

Getting Started

To begin using this template, simply click on "Start with this Template" on the Lazy platform. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy, paste, or delete any code manually.

Test: Deploying the App

Once you have started with the template, the next step is to deploy the app. To do this, press the "Test" button on the Lazy platform. This will initiate the deployment process and launch the Lazy CLI. The Lazy platform handles all deployment aspects, so you don't need to worry about installing libraries or setting up your environment.

Using the App

After deployment, Lazy will provide you with a dedicated server link to access the app's interface. Here's how to use the interface:

  • Visit the provided server link to access the welcome page of the CodeLine Counter app.
  • On the welcome page, you will see a form to upload a zip file. Click on the "Choose File" button to select the zip file containing your code files.
  • After selecting the file, click on the "Upload" button to submit the file for processing.
  • The app will then unzip the file, count the lines of code in each supported file, and display the results on a new page.
  • You can review the number of lines of code for each file and the total lines of code processed.

Integrating the App

If you wish to integrate the CodeLine Counter app into an external service or frontend, you may need to use the server link provided by Lazy. For example, you could:

  • Add the server link to an external dashboard to display code analysis results.
  • Use the API endpoints provided by the app to fetch results programmatically from another application.

Remember, the CodeLine Counter app is designed to be used within the Lazy platform, and all necessary configurations are handled for you.

If you have any questions or need further assistance, feel free to reach out to the Lazy customer support team. Happy building!

Category
Technology
Last published
June 15, 2024

More templates like this

PDF Data Extraction and Excel Transfer

An app for extracting name, phone number, and email data from PDF files and transferring it to Excel.

PDF
Python

GPT-4 Exam Generator

This app uses GPT-4 to generate a PDF of a new exam based on an uploaded PDF of a past exam.

PDF
OpenAI
Python

Job Search Website

A customisable one-page job search website with a search bar and a search button that displays UI cards of matching jobs. You need to have a (free) account on https://rapidapi.com/ to get the API key required for this to work.

React JS
Python
Flask
HTML
CSS
Home
/
CodeLine Counter