ruby rake rspec simplecov....again - rake

I'm having trouble finding a simple example on how to use simplecov with rake/rspec.
Here's the repo I have setup: https://github.com/stensonb/simplecov-playground
If you clone this, and "bundle install", "rake coverage", you'll see 0/0 LOC...which is disappointing.
As the project sits now (8e5fa35983), I expect there to be 0/XX LOC (where XX is the actual lines of code I have...clearly more than zero - look at /lib/mytest.rb)
Things I've tried:
adding "require 'simplecov'" and "SimpleCov.start" to my spec_helper.rb
adding groups to the simplecov config
Anybody have a suggestion on how to get this thing to work?

Solved!
The major item I was missing was "requiring" my lib file in my test.
I had assumed simplecov would pull in ALL of my files by looking at the directory structure...but that doesn't appear to happen. It will only asses the codes explicitly loaded into the classpath (to use java parlance)...using "requires", or "load", or "include", I assume.
I'll push my solution back to this github location later today.

Related

Code Coverage Visualization for Dart/Flutter (Specially for Windows and VS Code)

This was originally a Github Issue in the Dart-Code repository.
1. Context
I've been working on a package that has hundreds of tests, so an easy way of visualizing code coverage would be incredibly handy.
I would like to run my tests with, say, a .vscode configuration with an lcov.info output which would automatically be recognized by VS Code and highlighted on the respective editors with either red or green.
2. What I've Already Tried
I've tried many different solutions in the past few days — months actually — but none of them worked as the ideal one described above:
flutter test --coverage --coverage-path=lcov.info does work to generate the necessary file, but it's clunky to have to visualize it through a 3rd party program such as genhtml, all the more if you're on Windows.
And it does need Flutter in the end, which should not be necessary if you're working on pure Dart...
IntelliJ would supposedly work ideally, but I just can't seem to enable the Run with Coverage button on mine, even after installing the test_coverage package.
Though one person on Gitter told me he has it working on his IntelliJ.
Both the coverage and the test_coverage packages offer something close to what I described above, but their solutions are way clunkier — and on Windows they are tough to set up...
codecov.io is an alternative with a 3rd party, but it's annoying to have to handle this externally when the editor offers a much more flexible and faster experience.
And there is also the problem of ambiguous coverage, which is not clear with respect to codecov.io. For example, if one folder tests stuff that indirectly calls another folder, does that count as coverage for the indirectly called folder as well? That's almost always undesirable.
3. Other Resources
There's this old question on StackOverflow that was helpful initially.
You can take the genhtml.perl script here.
If you have Git for Windows installed on your machine, you already have Perl installed, it should be here: <git-install-dir>\usr\bin\perl.exe
Replace backslash characters (\\) with slash characters (/) in all file path lines (prefixed with SF:) in the lcov.info file.
Run genhtml.perl script. For example — assumed current working directory is root directory of your project —:
<git-install-dir>\usr\bin\perl.exe \
C:\Scripts\genhtml.perl \
-o .\coverage\html .\coverage\lcov.info
Note. It may be useful also to add the --prefix option.
As a result of these actions, you should get generated HTML report in the .\coverage\html/ directory. Open .\coverage\html\index.html file in your browser to see the report.
I hope this helps — at least, it worked for me.

upgrade from Artifactory 2.3.3.1

As in the subject, we are currently stuck at very (!) old version 2.3.3.1. We must upgrade to the latest (or a least a much more recent) version.
I suspect I'll need a few steps to make such a version leap.
Please give me any pointers you may find useful. This has landed on me, and I've never worked with Artifactory before.
As you suspected, there are several versions you'll have to go through, like 3.9.x.
You can find more info here and here
Following the directions above:
I have taken us to 2.6.7 as a necessary upgrade step, and today I worked on moving to 3.9.2 as a next necessary step.
I have followed the official instructions from https://www.jfrog.com/confluence/display/RTF3X/Upgrading+Artifactory
The "empty" 3.9.2 worked fine of course, so I proceeded with the copy of the filestore and then the import of the System export. The Export had been done as instructed, i.e. with Content excluded, and nothing else excluded.
The import finished but with 99 errors. These were of these three types:
A file missing from the export. In all cases, the export contained a folder with the same name as the file but with a ".artifactory-metadata" appended to its name. So for example instead of
/BACKUP_DISK/ARTIFACTORY/20200402.192450/repositories/jboss-releases-cache/jboss/jboss-j2ee/4.2.0.GA/jboss-j2ee-4.2.0.GA.pom
...in the export there was this folder:
/BACKUP_DISK/ARTIFACTORY/20200402.192450/repositories/jboss-releases-cache/jboss/jboss-j2ee/4.2.0.GA/jboss-j2ee-4.2.0.GA.pom.artifactory-metadata/
...containing two files, artifactory-file.xml and artifactory.stats.xml
Errors about failure to import a file because "MD5 value 'null' is not a valid checksum"
Errors about failure to import file because " Artifact rejected: The repository 'codehaus-cache' is blacked out and cannot serve artifact"
The last disturbing thing is that the new installation in the Home page states that there are half as many artifacts as in the 2.6.7 installation. I wonder if some kind of merging/relabelling has been done, and I should not worry about that.
I'd be grateful for any clues on the above.

Microsoft.Quantum.Canon.nuspec missing

I am playing around with Microsoft's Q# library, and I've gone through the install, however the build is failing and I am having a tough time figuring out the problem. My first suspicion is Microsoft.Quantum.Canon
EXEC : error QS1001: Assembly E:\Projects\Quantum\Microsoft.Quantum.Canon\bin\Debug\Microsoft.Quantum.Canon.dll not found
I also have noticed Microsoft.Quantum.Canon.nuspec is missing. I've tried to do a Nuget.exe restore on the solutions but that did not work.
Has anyone worked through this?
It's been reported on GitHub already, although it appears to be intentional. See the comments in the .gitignore file:
# These files are generated by bootstrap from a .v.template (version template).
# Any changes must be done to the corresponding the .v.template file directly
Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.nuspec
I can't find any info on this .v.template file, probably it's part of internal Microsoft build tooling. You can copy the template file and fill in the missing parameters if you wish, but the file not existing doesn't make the build fail , does it?

Confusion: GitHub Project broken(?), Instructions not clear: Mercurial setup(?)

first of all, i've never done something with github, this is my first try, so please be polite and help me on the train.
I would like to use this github-project:
https://github.com/jmmcatee/cracklord which is completly in go language.
from the instructions:
If you'd like to get things build from source, it will first require you to have a working Go build environment with the GOPATH setup. Additionally, you'll probably want Git and Mercurial setup to gather the various libraries and plugins that we've used in the code.
Here are my Questions:
I've done installing git and i'm able to clone the repro, which works fine.
I've installed mercurial, but have no idea how to "setup" mercurial.
Can someone explain what mercurial setup togehter with this githubproject example means?
why i'm asking
after creating a directory git-repos
changing into this directory with cd git-repos
path is now /root/git-repos
# set GOPATH to /root/git-repos
export GOPATH=/root/git-repos
and doing go get github.com/jmmcatee/cracklord
gives this error-message:
go get github.com/jmmcatee/cracklord
can't load package: package github.com/jmmcatee/cracklord: no Go files in /root/git-repos/src/github.com/jmmcatee/cracklord
okay.
So, when i'm following the instructions i'm not able to finish. Can someone explain what i'm doing wrong?
Thank you
Paul
You don't need to set gopath anymore, it is set by default to:
~/go
You don't say which os you're using, but given your paths I assume linux. I suspect you haven't exported the environment variable correctly. You might want to try setting up a simpler package first and verifying you have your go setup right. Follow the instructions here (including verifying your setup is working, and just using the default gopath):
https://golang.org/doc/install
And try downloading and running something simpler (which doesn't require several components installed) to verify your setup first.

Issue running golang Hello World in eclipse

Alright, so just a disclaimer I suspect this question will be a duplicate of another question however I'm not even sure what to search for.
I have never used Eclipse or Golang before and am attempting to get a basic hello world application to work.
I have installed the goclipse plugin, created a new go package and go command source file. From what I have read to run a project in Eclipse you right click the package, select Run as then set the run configurations. The problem occurs when I attempt to select the go package as none shows up and if I leave it blank it throws a 'Go package not found' exception.
Thank you for any help you can provide.
EDIT: Upon the answers advice I have decided to go with the basic command line, however a friend did also recommend LiteIDE. I will "assume" tmichels answer is correct in regards to getting Go to work within eclipse.
If you don't use the GOPATH environment variable and you don't put your project folder under $GOPATH/src the compiler won't find it. As I see it goclipse lets you skip the GOPATH entirely but in this case you have to put your code under the src directory that you can see in the Project Explorer. See the related section of the goclipe documentation.
Although I think you make your life harder by using a full-fetched IDE for go development. Just use the command line tools. And it has the added benefit that you will actually understand what's going on (IDEs hide this from you).
So for building you can use go build or go install. The latter will copy the binary to your $GOPATH/bin directory. For running test just call go test or go test path/to/package. There is a hidden gem in the go tool: when you are working with multiple packages in the same directory you can use go test ./... to test all of them at once. This also works with other go commands.