Coder Social home page Coder Social logo

catastrophe-brandon / linknotfound Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eduardocerqueira/linknotfound

0.0 0.0 0.0 625 KB

Proof of Concept for finding broken links in applications source code

License: GNU General Public License v3.0

Shell 9.96% Python 76.54% HTML 9.30% Dockerfile 4.21%

linknotfound's Introduction

CI Linux GitHub tag GitHub issues

linknotfound

This project is a POC, proof of concept for a simple tool to find and report broken links from an application source code.

It is a client and server applications, where the client also referred as scanner collect and analyze the repos and send the report to S3 bucket. The server is retrieves the reports from S3 bucket and present to the user.

This repository doesn't intend to be a final version of this poc, as well should not run in a production environment, as a public and open-source code you can use it with your own risks and contributions are welcome!.

diagrams

diagram
high-level overview for the scanner client and web applications

diagram
not implemented, future idea integrating with GH PR and workflow, triggered by new PR event

Contributing and running the application

Requirements

  • GitHub OauthAPI GITHUB_TOKEN
  • Python 3

Development environment

From the path ./linknotfound run the script below to set developer environment for this program in a consistent way:

sh ops/scripts/set_dev_env.sh

Or if you prefer to set it manually, from the path ./linknotfound run the command below:

pip install --editable .[dev]

configuration

This program requires some configuration before running it. You can use the template file linknotfound/linknotfound.conf.sample for creating linknotfound/linknotfound.conf then update it with your credentials, or you can set environment variables before running the program.

Environment variables have high priority during the load, overriding the configurations from the file, if it exists. To set as environment variable, the variable name must start with LNF_ and following the section and the configuration key and value as example:

in linknotfound.conf:

[github]
organization = "*********"
token = "**********"

as environment variables:

LNF_GITHUB_ORGANIZATION="*********"
LNF_GITHUB_TOKEN="**********"

running

If running the program from your local development environment, use the path ./linknotfound/linknotfound as the root before running the commands below. If running in container, you must be in the path ./linknotfound

# see help
linknotfound

# checking installation
linknotfound test

# running the scanner
linknotfound scan

# running the web
linknotfound web

running in container

Run the commands below to build and run linknotfound in container.

sh ops/scripts/docker_build.sh
sh ops/scripts/docker_run.sh

You can pass arguments when running the script:

sh ops/scripts/docker_run.sh test
sh ops/scripts/docker_run.sh scan
sh ops/scripts/docker_run.sh web

For running the scan you can pass all configuration by environment variables:

docker run \
-e LNF_GITHUB_ORGANIZATION="my-org" \
-e LNF_GITHUB_TOKEN="******" \
-e LNF_REPOS_CONTAINS="['-ui', '-frontend']" \
-e LNF_SCAN_REGEX="((http|https)\\:\/\/)?(doc\\.domain\\.com\\/docs)+([a-zA-Z0-9\\.\\&\\/\\?\\:@\\-_=#])*" \
-e LINKNOTFOUND_RUN="scan" -it linknotfound /bin/bash

running the web application in container, notice you can add extra env variables if needed:

docker run -e LINKNOTFOUND_RUN="web" -p 8000:8000 -it linknotfound /bin/bash

Web application

for development, run the application on debug mode to activate the auto-reload.

flask --app web.py --debug run

contributing

Any PR is welcome and will pass through the code-review process. Be responsive with the code organization and run lint from the path ./linknotfound before your contributions:

pre-commit run --all

links





Life is too short to be serious all the time! So, if you can't laugh at yourself, call me... I'll laugh with you.

linknotfound's People

Contributors

eduardocerqueira avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.