Git Product home page Git Product logo

slick's People

Contributors

abourget avatar bosgood avatar bpostlethwaite avatar bronsolo avatar errows avatar etpinard avatar hectormalot avatar iwittkau avatar jackwilsdon avatar jaytaylor avatar kiliankoe avatar mabeauchamp avatar matt0x6f avatar rubensayshi avatar scjody avatar screamingtaco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

slick's Issues

Add dashboard page

Expected Behavior

A webpage that provides basic information about the connection and state.

Current Behavior

N/A.

Possible Solution

Context

This is a first for a chatbot, I believe. Most chatbots do not have web interface.

Add continuous integration

Would be nice to run the tests on every change. We should add Travis CI and some code coverage platform.

A new name for slick

Unfortunately, @abourget has not gotten back to me after the numerous times I've tried to reach him about taking over slick and even doing a forward from the old repository.

I think at this point I'm ready to hard-fork the repo. This comes with numerous advantages that a fork like this one does not afford us.

In doing this I think we should probably rename the repository to avoid confusion with the old repository and the old maintainers. I'd love to hear some suggestions for a new name.

Problem with create a Dockerfile

It's my first issue ever, so hello everyone :) So..
I'm trying run slick in Docker, so I write some code:

FROM golang:alpine as builder
RUN mkdir /build
RUN apk add --update gcc go git mercurial \
    && go get github.com/CapstoneLabs/slick
ADD . /build/
WORKDIR /build
RUN go install -v 
FROM alpine
RUN apk --no-cache add ca-certificates
RUN adduser -S -D -H -h /app appuser
USER appuser
COPY --from=builder /build/main /app/
WORKDIR /app
EXPOSE 8080
CMD ["./main"]

But I get a Error:

github.com/CapstoneLabs/slick
src/github.com/CapstoneLabs/slick/bot.go:142:11: bot.Slack.SetDebug undefined (type *slack.Client has no field or method SetDebug)
src/github.com/CapstoneLabs/slick/updateable.go:29:105: cannot use u.newFormattedMessage() (type string) as type slack.MsgOption in argument to u.reply.bot.Slack.UpdateMessage

So my question is how to build this app correctly?

Setup Go modules Part 1

Part 1 is just getting a go.mod file running.

There is a 302 that's occurring that modules seem not to play well with.

Setup Go Modules Part 2

This is an actual CI change. We need to cut a version branch and apply the version tag to its latest commit.

Missing sample config file

We need proper ..slick.conffor example-bot, at this moment I use plotbot.sample.conf but is invalid.

$ docker logs slick
time="2018-10-17T11:00:26Z" level=error msg="Error in config JSON syntax." error="invalid character '\"' after object key:value pair"
time="2018-10-17T11:00:26Z" level=fatal msg="Error loading config file." error="invalid character '\"' after object key:value pair"

To reproduce errors:

docker build -t slick .
docker run -d --name slick slick:latest
docker logs slick

Replace deprecated API's

Slack deprecated several ev.Info API's which were used to determine channels, IM's, and groups. The nlopes/slack package API's still work but return an empty struct.

Better coverage for message.go

Here's the functions that can be tested but are not:

func (msg *Message) String() string {
        return fmt.Sprintf("%#v", msg)
}

func (msg *Message) applyMentionsMe(bot *Bot) {
        if msg.IsPrivate() {
                msg.MentionsMe = true
        }

        m := reAtMention.FindStringSubmatch(msg.Text)
        if m != nil && m[1] == bot.Myself.ID {
                msg.MentionsMe = true
        }
}

func (msg *Message) applyFromMe(bot *Bot) {
        if msg.User != "" && msg.User == bot.Myself.ID {
                msg.FromMe = true
        }
}

var reAtMention = regexp.MustCompile(`<@([A-Z0-9]+)(|([^>]+))>`)

// Format conditionally formats using fmt.Sprintf if there is more
// than one argument, otherwise returns the first parameter
// uninterpreted.
func Format(s string, v ...interface{}) string {
        count := len(v)
        if count == 0 {
                return s
        }
        return fmt.Sprintf(s, v...)
}

Add tests for dates.go

dates.go needs some tests. Use of the testify package is not required, test tables are fine too.

Asana plugin tests

I wrote some test cases for this plugin, but from the function GetTasksByAssignee i need real Asana access.
Therefore, should I set up an Asana's account or leave tests at this stage?

Add CI Releases

Currently go test -short, gofmt, and go vet are running for every pull request.

When a PR is merged to master we should:

  1. Build the package
  2. Cut a git tag
  3. Post to releases (https://docs.travis-ci.com/user/deployment/releases/)

Go Modules are based on repo tags in combination with semantic version. This process would support that.

This probably also means we need a VERSION file that can be updated and read from both by Go and CI tooling.

Duplicates #8

Refactor channel tests to use testify package

The testify package promotes some nice testing patterns. They are a bit more familiar to me coming from Python so maybe they'll help others too.

This is kind of an experiment so it may be not merged or removed in the future.

PR Template not being utilized

Expected Behavior

PR Template content should populate the PR body.

Current Behavior

PR body is blank

Possible Solution

Rename the file to pull_request_template.md from generic.md.

Steps to Reproduce

  1. Open a new PR

Context

People are making PR's without creating issues first because the PR doesn't remind them to.

Your Environment

  • Version used: N/A
  • Go version: N/A
  • Operating System and version (desktop or mobile): N/A
  • Link to your project: N/A

References

Remove non-generic Plotly plugins

Plotly wrote a lot of plugins that are very specific to them and have no place in the core code. These could be easily attached using Slick's plugin system.

A list of plugins to remove:

  • Deployer (Obviously very specific to Plotly)
  • Blaster (I have no idea what this does)
  • TOTW (This looks useless)

Plugins to refactor:

  • Bugger (Missing GitLab integration)
  • Hooker (A system for webhooks, needs to be generified and renamed)
  • Plotberry (Probably needs to be renamed)
  • Tabularasa (An extension of the Asana plugin)

Add tests for everything

This will probably be an issue that needs to be split out but we can use this issue to garner more attention.

Currently, the bot is nearly 100% untested, from its core functionality to the plugins.

Add a Kubernetes manifest

In order to do some of the integration tests I'd like to do in the future, we'll need a place to run Slick. A Kubernetes manifest not only serves as a form of documentation on how to run Slick but also gives us a start on integration tests.

I could use some help

This post is really here as a landing page for places like Reddit. While Capstone has donated a considerable amount of time to resurrecting Slick, it really needs a lot of TLC.

  • The config reader could benefit from Viper
  • Just about everything needs tests
  • Some tests that already exist aren't meaningful
  • Travis Configuration (If you jump on this, let me know, I can help)

I bring this up because it's Hacktoberfest but there's also a lot opportunities for those that are still in the early stages of learning Go. I'm actually within my own first year.

We chose Slick because it's a very functional and extensible package, it's not another Javascript Slackbot, and because there didn't seem to be other Go chatbot packages out there.

Open a PR and let's start merging :)

Add tests for message.go

Test the return functions of message.go

Some functions are action functions which do need to be tested but should be tested in integration testing.

Add logrus

Logrus will enable configurable logging

Getting two errors when building the project (Help)

Trying to build the project, I'm getting the following error in master:

./bot.go:142:11: bot.Slack.SetDebug undefined (type *slack.Client has no field or method SetDebug)
./updateable.go:29:105: cannot use u.newFormattedMessage() (type string) as type slack.MsgOption in argument to u.reply.bot.Slack.UpdateMessage
FAIL    github.com/jegutierrez/slick [build failed]

Am I doing something wrong? or is there another branch where this is not happening?

Thanks in advance,
Je

Add tests to deployer.go

At this moment I have 3 basic test cases for parms.go:

func TestParsedTags(t *testing.T) {
	var dp1 = DeployParams{
		Tags: "version-1.12",
	}
	var dp2 = DeployParams{
		Environment: "stage",
	}
	t1 := dp1.ParsedTags()
	t2 := dp2.ParsedTags()
	if t1 != "version-1.12" || t2 != "updt_streambed" {
		t.Errorf("Function ParsedTags - ERROR")
	}
}
func TestParsedDeploymentBranch(t *testing.T) {
	var dp1 = DeployParams{
		DeploymentBranch: "version-1.11",
	}
	var dp2 = DeployParams{
		Environment: "stage",
	}
	t1 := dp1.ParsedDeploymentBranch("Develop")
	t2 := dp2.ParsedDeploymentBranch("Develop")
	if t1 != "version-1.12" || t2 != "Develop" {
		t.Errorf("Function ParsedDeploymentBranch - ERROR")
	}
}

func TestStringer(t *testing.T) {
	var dp = DeployParams{
		Environment:      "STAGE",
		DeploymentBranch: "Develop",
		Tags:             "ver-1.12",
		InitiatedBy:      "3sky",
	}
	if fmt.Sprintf("%s", &dp) != "env=STAGE branch=[default] tags=ver-1.12 deploy_branch=Develop by 3sky" {
		t.Errorf("Function Stringer - ERROR")
	}
} 

The next step I want to do it's testing rest of deployer functions. To do that some mock for exec command is needed, any ideas how deal with that ?

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.