DEV Community

Cover image for A GitHub Action to find dead code using Vulture
Anay Nayak
Anay Nayak

Posted on • Updated on

A GitHub Action to find dead code using Vulture

My Workflow

Vulture is an awesome static code analyzer which helps identify dead code in Python repositories. As a python project maintainer, it is useful to know if a new pull request has introduced any dead code.

The GitHub Actions Hackathon on DEV was an opportunity to experiment with Github Actions and make it easier to find dead code. The Github Actions marketplace didn't have any existing actions for Vulture and so I decided to write one.

Sample run: https://github.com/anaynayak/python-vulture-action/actions/runs/227230739

Diff shown on a Pull request

I have enabled it on one my other repositories BuildNotify and it helped me realise that I had introduced some dead code as well 😄

Here is the link if you'd try it on your repository Python Vulture Action

Sample workflow

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    name: vulture
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Scavenge
        uses: anaynayak/python-vulture-action@v1
        id: vulture
        with:
          vulture-args: src --min-confidence 90
Enter fullscreen mode Exit fullscreen mode

Submission Category:

Maintainer Must-Haves

Yaml File or Link to Code

GitHub logo anaynayak / python-vulture-action

Run Vulture on your Python codebase to identify dead code.

Python Vulture Action

This action runs Vulture on your Python codebase.

Inputs

vulture-args

Required Arguments passed to the vulture cli.

Usage

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    name: vulture
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Scavenge
        uses: anaynayak/python-vulture-action@v1
        id: vulture
        with:
          vulture-args: example --min-confidence 90
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

https://github.com/anaynayak/buildnotify/
https://pypi.org/project/vulture/

cover photo by Chris Ried on Unsplash

Oldest comments (0)