codeclimate-tslint icon indicating copy to clipboard operation
codeclimate-tslint copied to clipboard

unable to add engine to codeclimate

Open daudt opened this issue 8 years ago • 22 comments

I'm using the latest docker image from code climate. Here's what I've tried to get tslint to work with cc: npm i codeclimate-tslint --save-dev codeclimate engines:enable tslint

Engine not found. Run 'codeclimate engines:list' for a list of valid engines.

Any ideas? Thanks.

daudt avatar Mar 11 '16 18:03 daudt

@daudt If you have the image locally, you should be able to run codeclimate analyze --dev in a project which has tslint listed in the .codeclimate.yml. We're working on getting the tslint engine released.

mrb avatar Mar 11 '16 19:03 mrb

@mrb thanks for answering question! @daudt as such, could you wait for a moment? thanks.

tkqubo avatar Mar 13 '16 15:03 tkqubo

Any progress here? 😸

axe312ger avatar Apr 19 '16 08:04 axe312ger

Sorry I'm still struggling to solve some issues.

Both npm start and codeclimate analyze --dev work on my MacBook, but when I setup CentOS 7 environment and try to run npm start, it fails with

/usr/src/app/node_modules/glob/sync.js:328
        throw er
        ^

Error: EACCES: permission denied, scandir '/code'
    at Error (native)
    at Object.fs.readdirSync (fs.js:856:18)
    at GlobSync._readdir (/usr/src/app/node_modules/glob/sync.js:275:41)
    at GlobSync._processReaddir (/usr/src/app/node_modules/glob/sync.js:135:22)
    at GlobSync._process (/usr/src/app/node_modules/glob/sync.js:130:10)
    at new GlobSync (/usr/src/app/node_modules/glob/sync.js:46:10)
    at Function.globSync [as sync] (/usr/src/app/node_modules/glob/sync.js:24:10)
    at /usr/src/app/dist/fileMatcher.js:21:53
    at arrayMap (/usr/src/app/node_modules/lodash/lodash.js:620:23)
    at Function.map (/usr/src/app/node_modules/lodash/lodash.js:8600:14)

Actually the command that's failing is

docker run -v $(pwd):/code -v $(pwd)/config.json:/config.json tkqubo/codeclimate-tslint

Even though I change the permissions of all the files and sub-directories to 777 but still fails.

And for codeclimate analyze --dev on CentOS, it fails with No '.codeclimate.yml' file found. while there is actually .codeclimate.yml on the current directory...

I have currently no idea what to do to them, Docker is a bit difficult to me :cold_sweat:

tkqubo avatar Apr 19 '16 17:04 tkqubo

We would really like to use this engine for our project! Is there any progress or a workaround to get this running on codeclimate?

mathebox avatar Jun 12 '16 10:06 mathebox

Sorry recently I have no progress on this project at all... But I will tackle this again soon!

tkqubo avatar Jun 15 '16 15:06 tkqubo

If I can help in some way, please let me know.

mathebox avatar Jun 15 '16 15:06 mathebox

Sorry I still stuck with codeclimate execution. Here is what I did:

    1. Setup clean CentOS 7 environment in VirtualBox (CentOS 7.2 (1511))
    1. Install required commands except codeclimate
$ sudo yum upgrade -y
$ sudo yum install -y git docker gcc-c++ make
$ sudo groupadd docker
$ sudo gpasswd -a ${USER} docker
$ sudo service docker start
    1. log in again and install codeclimate
$ curl -L https://github.com/codeclimate/codeclimate/archive/master.tar.gz | tar xvz
$ cd codeclimate-master
$ sudo make install
    1. :x: execute codeclimate analyze --dev
$ codeclimate analyze --dev
# then error message:
No '.codeclimate.yml' file found. Run 'codeclimate init' to generate a config file.
    1. :x: so then codeclimate init
$ codeclimate init
# different error message
Generating .codeclimate.yml...
error: (Errno::EACCES) Permission denied @ dir_initialize - /code
    1. :x: next, run docker as daemon
$ sudo service docker stop
$ sudo docker daemon
# then from another process,
$ codeclimate analyze --dev
docker: Error response from daemon: Cannot start container 8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574: [9] System error: exit status 1.
  • here is the logs from docker daemon
WARN[0000] devmapper: Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section.
WARN[0000] devmapper: Base device already exists and has filesystem xfs on it. User specified filesystem  will be ignored.
INFO[0000] [graphdriver] using prior storage driver "devicemapper"
INFO[0000] Graph migration to content-addressability took 0.00 seconds
INFO[0000] Firewalld running: false
INFO[0000] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
INFO[0000] Loading containers: start.
.
INFO[0000] Loading containers: done.
INFO[0000] Daemon has completed initialization
INFO[0000] Docker daemon                                 commit=9419b24-unsupported execdriver=native-0.2 graphdriver=devicemapper version=1.10.3
INFO[0000] API listen on /var/run/docker.sock
INFO[0002] {Action=create, Username=tkqubo, LoginUID=1000, PID=22164}
INFO[0002] {Action=attach, ID=8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574, Username=tkqubo, LoginUID=1000, PID=22164}
INFO[0002] {Action=start, ID=8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574, Username=tkqubo, LoginUID=1000, PID=22164, Config={Hostname=8bb00bb5fdb6, AttachStdin=true, AttachStdout=true, AttachStderr=true, Tty=true, OpenStdin=true, StdinOnce=true, Env=[CODECLIMATE_CODE=/home/tkqubo/codeclimate-master CODECLIMATE_TMP=/tmp/cc CODECLIMATE_DEBUG CONTAINER_MAXIMUM_OUTPUT_BYTES CONTAINER_TIMEOUT_SECONDS ENGINE_MEMORY_LIMIT_BYTES PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin CODECLIMATE_DOCKER=1], Cmd={parts:[analyze --dev]}, ArgsEscaped=false, Image=codeclimate/codeclimate, WorkingDir=/usr/src/app, Entrypoint={parts:[/usr/src/app/bin/codeclimate]}, NetworkDisabled=false, Labels=map[]}, HostConfig={Binds=[/home/tkqubo/codeclimate-master:/code /tmp/cc:/tmp/cc /var/run/docker.sock:/var/run/docker.sock], LogConfig={Type:json-file Config:map[]}, NetworkMode=default, PortBindings=map[], RestartPolicy={Name:no MaximumRetryCount:0}, DNS=[], DNSOptions=[], DNSSearch=[], Privileged=false, PublishAllPorts=false, ReadonlyRootfs=false, ShmSize=67108864, Resources={CPUShares:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CpusetCpus: CpusetMems: Devices:[] KernelMemory:0 Memory:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:0xc20883d428 OomKillDisable:0xc20883d432 PidsLimit:0 Ulimits:[]}}}
INFO[0002] Config: &{CommonCommand:{ContainerPid:0 ID:8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574 InitPath:/.dockerinit MountLabel: Mounts:[{Source:/home/tkqubo/codeclimate-master Destination:/code Writable:true Data: Propagation:rslave} {Source:/tmp/cc Destination:/tmp/cc Writable:true Data: Propagation:rslave} {Source:/var/lib/docker/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/secrets Destination:/run/secrets Writable:true Data: Propagation:} {Source:/var/lib/docker/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/shm Destination:/dev/shm Writable:true Data: Propagation:rprivate} {Source:/var/lib/docker/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/resolv.conf Destination:/etc/resolv.conf Writable:true Data: Propagation:rprivate} {Source:/var/lib/docker/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/hostname Destination:/etc/hostname Writable:true Data: Propagation:rprivate} {Source:/var/lib/docker/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/hosts Destination:/etc/hosts Writable:true Data: Propagation:rprivate} {Source:/var/run/docker.sock Destination:/var/run/docker.sock Writable:true Data: Propagation:rslave}] Network:0xc2089ffbc0 ProcessConfig:{CommonProcessConfig:{Cmd:{Path: Args:[] Env:[PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=8bb00bb5fdb6 TERM=xterm CODECLIMATE_CODE=/home/tkqubo/codeclimate-master CODECLIMATE_TMP=/tmp/cc CODECLIMATE_DOCKER=1] Dir: Stdin:<nil> Stdout:<nil> Stderr:<nil> ExtraFiles:[] SysProcAttr:0xc208a0f7a0 Process:<nil> ProcessState:<nil> lookPathErr:<nil> finished:false childFiles:[] closeAfterStart:[] closeAfterWait:[] goroutine:[] errch:<nil>} Tty:true Entrypoint:/usr/src/app/bin/codeclimate Arguments:[analyze --dev] Terminal:<nil>} Privileged:false User: Console:} ProcessLabel: Resources:0xc2089e0f00 Rootfs:/var/lib/docker/devicemapper/mnt/bb7b835888be871447cd416993bd5eaf201816bcda6b51974b959948acc2048f/rootfs WorkingDir:/usr/src/app TmpDir:/var/lib/docker/tmp/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574622022844 ContainerJSONPath:/var/lib/docker/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/config.v2.json} AllowedDevices:[0xc20803a2d0 0xc20803a320 0xc20803a5a0 0xc20803a5f0 0xc20803a640 0xc20803a690 0xc20803a6e0 0xc20803a780 0x1fc0cc0 0x1fc0d20 0x1fc0d80 0x1fc0de0 0x1fc0e40 0x1fc0ea0] AppArmorProfile: AutoCreatedDevices:[0xc20803a7d0 0x1fc0cc0 0x1fc0d20 0x1fc0d80 0x1fc0de0 0x1fc0e40 0x1fc0ea0] CapAdd:[] CapDrop:[] CgroupParent:/docker GIDMapping:[] GroupAdd:[] Ipc:0xc20882fc80 OomScoreAdj:0 Pid:0xc2089dbbe5 ReadonlyRootfs:false RemappedRoot:0xc2089dbbf0 SeccompProfile: Sysctls:map[] UIDMapping:[] UTS:0xc2089dbbe6}
WARN[0002] signal: killed
ERRO[0002] error locating sandbox id 3931f17f30487e6882b2bb60486107fe3c1e2017e45258581561d8019d3f71c9: sandbox 3931f17f30487e6882b2bb60486107fe3c1e2017e45258581561d8019d3f71c9 not found
WARN[0002] failed to cleanup ipc mounts:
failed to umount /var/lib/docker/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/shm: invalid argument
ERRO[0002] Error unmounting container 8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574: not mounted
ERRO[0002] Handler for POST /v1.22/containers/8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574/start returned error: Cannot start container 8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574: [9] System error: exit status 1
INFO[0002] {Action=remove, ID=8bb00bb5fdb6db6b7e8fc28f1d11a539e912d4a1987ba631e9f97fb09e546574, Username=tkqubo, LoginUID=1000, PID=22164}

I don't know this is due to docker or codeclimate. Is there anyone who knows why this happens?

tkqubo avatar Jun 30 '16 07:06 tkqubo

I was able to run codeclimate analyze --dev to run codeclimate-tslint both locally on macOS and on CentOS with the changes in pull request #6. I believe this corrects this issue, please try it out and let me know if you are still not able to run via Docker.

brantw avatar Aug 15 '16 22:08 brantw

@tkqubo I think that issue has to do with docker/CentOS-- as with @brantw I'm able to run codeclimate analyze --dev locally (at least on macOS)

avegancafe avatar Aug 28 '16 04:08 avegancafe

Hey Everyone - https://github.com/swimlane/codeclimate-tslint is working but needs some testing! If anyone has time to run through some of the QA spreadsheet, let me know.

mrb avatar Sep 02 '16 14:09 mrb

💯! I'm down

avegancafe avatar Sep 02 '16 14:09 avegancafe

@kyleholzinger The spreadsheet is here - https://docs.google.com/spreadsheets/d/1hGUh9EGTcRxND_uTJ684vgZV-9O-oRi75RgoEAEp1bE/edit#gid=0 - basically we need to run this through a few OSS repos to make sure it works. There is one additional bit of work to do, to add remediation_points to the engine output, but that can wait a bit.

mrb avatar Sep 02 '16 15:09 mrb

Sounds great man! I'll check it out when I get a chance

avegancafe avatar Sep 02 '16 18:09 avegancafe

@mrb sorry just getting back to this. I'm trying to install it locally again and having some issues. Could you post a step by step guide on how to install it? I've tried installing it via npm, npm -g, and cloning it but when I run codeclimate analyze --dev it says Unable to find image 'codeclimate/codeclimate-tslint:latest' locally

avegancafe avatar Jan 31 '17 16:01 avegancafe

Update: for anyone looking to install it and test it locally here are the steps to install:

  1. Install docker. I got it from here
  2. Clone this repo and build the docker image locally
git clone https://github.com/tkqubo/codeclimate-tslint/
cd codeclimate-tslint
docker build -t codeclimate/codeclimate-tslint .
  1. Go to your repo that has the ts files you want to lint in it and add the following to your .codeclimate.yml (or whatever your equivalent is)
  tslint:
    enabled: true
  1. Run codeclimate analyze --dev
  2. You're done!

avegancafe avatar Jan 31 '17 17:01 avegancafe

codeclimate-tslint can now be used on codeclimate.com with this config on codeclimate.yml:

engines:
  tslint:
    enabled: true
    channel: beta

see: https://github.com/codeclimate/codeclimate-duplication/issues/127#issuecomment-286554197

tiagoefmoraes avatar Mar 23 '17 14:03 tiagoefmoraes

I'm having problem running codeclimate-tslint on codeclimate.com, I get the following error: screen shot 2017-04-23 at 18 56 54 But when I run tslint 'src/**/*.{ts,tsx}' in my repo it says that everything is okay.

My .codeclimate.yml:

engines:
  tslint:
    enabled: true
    channel: beta
  scss-lint:
    enabled: true
  fixme:
    enabled: true
ratings:
  paths:
  - "src/**/*"
  - "**.ts"
  - "**.tsx"
  - "**.scss"
exclude_paths:
- dist/
- node_modules/

See https://github.com/Lapanti/ts-react-boilerplate/pull/28

lapanti avatar Apr 23 '17 15:04 lapanti

I'm getting the same error but only on codeclimate.com - directly calling codeclimate or tslint locally provides correct results. ~~The issue on codeclimate.com seems to be related to finding the configuration file.~~

It's related to having any type of external config - eg: tslint-config-airbnb, tslint-react, etc...

Maybe considering creating something similar to the eslint whitelist for tslint

murt avatar Apr 24 '17 01:04 murt

Good call, thanks for the info @murt! I'll look into adding some default external configs. Seems relatively easy enough! For now I'll try adding the airbnb and react ones, looks like that's what you're using @Lapanti

avegancafe avatar May 01 '17 02:05 avegancafe

What's the status on this? Do you need some help?

lapanti avatar Jun 07 '17 06:06 lapanti

Hey @Lapnati! Sorry been crazy busy at work lately (doing this on the side), we're testing out 10 repos that use TSLint and we're 60% of the way there. Here's the GitHub project I made to track our progress, feel free to help out! https://github.com/kyleholzinger/codeclimate-tslint/projects/1

avegancafe avatar Jun 07 '17 14:06 avegancafe