Code Monkey home page Code Monkey logo

hintman's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hintman's Issues

Implement simple trailing space removal function

Function with roughly with the following type (of course, we should use data types instead of tuples):

suggestNoTrailingSpaces :: (FilePath, Text) -> Maybe (FilePath, LineNumber, Text)

which generates suggestion comment for github with the same line but without trailing spaces if the line has one.

Module: Hintman.Suggest

And then implement function that takes list of files with lines and diffs and traverses all lines and generate all hints.

Submit all hints when a PR is open

This is a final issue. Basically, wire up everything together. This is a tricky issue, we need to figure out how to use GitHub API to submit comments for corresponding lines....

Describe steps how to configure and run github application locally (preferably in a form of shell script)

Documentation for building APP:

I would like to have instructions how to configure environment before running application. Better in a form of shell script. So in terminal everyone can just:

$ ./setup-app-env.sh
$ cabal new-exec hintman  # or `stack exec hintman`

If something is required to do manually, this should be specified in the README.md file.

Implement config data type that contains all checks

We now have multiple checks. And it's probably a good idea to have a config for our tool anyways. So we can create Config data type where we can store all checks and allow users to have .hintman.toml in their repos to disable or enable checks.

Should go in Hintman.Config module.

Refactor `HintmanAppM`

  • Rename HintmanAppM to just App
  • Rename HintmanEnv to just Env
  • Move App to Hintman.App.Monad
  • Move Env to Hintman.App.Env

Configure testing and write instructions

So everyone can test GitHub application. Here is the application:

It's created under my account but probably we need to create one under Kowainik. And also we probably need to create one more GitHub application for testing...

Also, probably we need to create an empty repository for testing. But this repository can be useful for both hintman and hit.

Comment signature verification

There's problem that requestBody is deprecated and getBodyChunks consumes request body making it not accessible to further. This problem should be solved after GSoC project for servant-auth when this library becomes extensible.

Let's not remove authentication completely. Just comment all code that verifies signatures (and remove cryptonite from dependencies) and just log incoming request in there.

Proper aggregating structure for suggestions

So, since we now have multiple hints, it actually makes sense to think about aggregating structure. So the overal structure is the following:

  1. Have the following top-level function
suggest :: [(FilePath, Text)] -> [Suggestion]

It takes path to file and content of this file and performs joinSuggestions . concatMap suggestSingle where
2. The function suggestSingle will split incoming text over lines and then run all our suggestions either on every line or on the whole content
3. We might have multiple suggestions for single line so we need to aggregate suggestions. For example, if we have trailing line \n we need to perform the only suggestion that removes this line, not two suggestions. So should Suggestion type be Monoid ๐Ÿค” Any ideas are appreciated!

cc @willbasky @sphaso @vrom911

Scaffold simple Servant API

Basically, implement simple API with servant that returns number 42 on some predefined URL like

/api/the-answer

We should use generic servant for that.

The module name can be Hintman.Server.

Fetch `InstallationId` on the application start

I'm not sure how it's going to work. But if we deploy GitHub app manually as a runnable server, we have to figure out how to persist installation ids to be able to restart server smoothly. If we store them only in memory we lose all information and can't run hintman over repos where it's already installed.

Check that the file ends with trailing newlines

Similar to #3 but should check that commit introduces trailing newlines.

Might be a bit hard but for every file we should check that diff lines at the end of this file doesn't introduce trailing newlines.

Let's do this in separate module Hintman.Suggest.TrailingNewline (probably later will be merged with what @willbasky is doing).

How to handle repos where Hintman is not installed?

It's possible to specify only some repositories via GitHub API to be accessible by Hintman. So there are two options:

  1. If events are not sent from disabled repos, we don't need to do anything. Just need to verify it.
  2. If events from disabled repos are sent then we need to store this information about all enabled repos inside the environment to not review PRs on disabled repos.

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.