Cobertura: How to interpret the colors - cobertura

I'm using cobertura and I am confused about the meaning assigned to the colors in the report. I checked the cobertura website, as well as their FAQ and github page, and searched old stack overflow questions, but I could not find an explanation of how cobertura highlights lines.
First let me say that the report appears to be different between eclipse and in firefox. In eclipse it is highlighting entire lines green, yellow, or orange. When shown in firefox, it's different. There is a line number, then a second column that holds an integer, then the source line. I am seeing places where the line number is highlighted green, and the rest of the line is red. I also noticed that cobertura never highlights the actual source line as green, it is only highlighting the first two columns green for some reason.
So let me guess as to the meaning of this (I am not saying this is right, this is my guess):
first column is green if there was a unit test that reached the test method containing that line.
second column is the number of unit test methods that reached that line
second column, and source line, will be highlighted red if ALL of the unit tests that reached that line failed, or if no unit test reached that line.
First question, is the above correct? If not then please let me know what's right.
My second question is this: I have a test class that is expected to throw an exception, it is annotated #Test(expected = IllegalArgumentException.class). The test method passes but cobertura highlights all of the lines in that class as red. Why does cobertura highlight this line red if the test passed? Is there a way I can change this behaviour?
Third and last question: if two test methods both reach a line of code, and one of those test methods fails, will the line of code be highlighted red? green? or something else?

Related

How to remove data within a multi-line cell that comes after a few line breaks

I have an excel spreadsheet which has content I don't need, following content I do need, within each cell, with a few line breaks in between. I would like to remove the bad content, using some sort of formula which states that in each cell, the line breaks & anything that follows them should be removed, for example:
cell A1 -
Three blind mice, three blind mice
See how they run, see how they run
They all ran after the farmer's wife
She cut off their tails with a carving knife
Did you ever see such a sight in your life as three blind mice?
Star Light, Star Bright
Twinkle, Twinkle, Little Star
Jack and Jill
I’m a Little Teapot
There are multiple line breaks between the nursery rhyme & the list of nursery rhyme titles that follow, but they aren't showing that way above. The image linked below shows it better.
In the above example, how can I remove the line breaks and the list of nursery rhymes, all I want to keep are the lyrics at the top?
Here is a screenshot of an example cell
example cell
Thanks
I've tried using the replace tool, but I can't figure out how to accomplish this.
find() return the starting position of a string with a string
char(10) is the "line feed" in asci (10) getting converted to character which can be searched
LEFT() simply returns the left part of the string up to the enter.
so..
=LEFT(A1,FIND(CHAR(10)&CHAR(10)&CHAR(10),A1)-1)
we find the first occurrence of 3 line breaks in a row.
We put the formula in Cell B2 then copy and past values over your original data if you truly no longer need it. Or just reference B2... and keep original values.
Reference: https://superuser.com/questions/370066/how-to-search-for-newline-or-linebreak-characters-in-excel
So:
Gives us:
We simply look for 3 consecutive line breaks and Keep everything to the left of it.

How to add to the list only 1 line from a text file for verifying content and after to move to next line?

The problem is a survey about what is the favourite colour. every line has 3 colours separated by space "blue yellow green". First is first place , 2nd is second place and 3rd is 3rd place. So after going over the text I must print some like "blue(1,0,0) , yellow(0,1,0), green(0,0,1). I need to return this as a tuple so I thought to convert List into tuple after I will have final result of survey.
I thought to add the Line to the list and after to iterate through the list to see what colours I have on what place. I just started to learn Python so I'm pretty bad on it. If anyone have better ideas please let me know.
Thanks A Lot!
enter image description here

Highlight positions after the EOL character

I am, currently, attempting to replicate the vim feature 'colorcolumn'. In addition to replicating 'colorcolumn', I have ideas that would require replicating 'cursorcolumn' and 'cursorline'. However, all my attempts to match a specific column are dependent on a character occupying that specific column.
To put it another way, I cannot come up with a way to match any position after the EOL ('$') character.
For instance, the following will only highlight column 25 if a character occupies that position. This is, similarly, true for :match, match(), matchadd(), and matchaddpos().
:highlight CC2 ctermbg=green
:syntax match CC2 /\%25v./
I don't want to focus too much on a particular idea, but my present idea for 'colorcolumn' is to have several different columns (which is easy enough; :set cc=10,20,30), but each column would have it's own background color. Say, green at column 80, yellow at 100, and red at 120.
Any other suggestions?
This is not possible, since match works only on the buffer content, so if there is no content, the column can't be matched.
BTW: That is one reason, why the 'colorcolumn' option has been implemented.

Highlight multiple positions in VIM independant of the content of the buffer

I would like to highlight certain positions in VIM. The solution should work for empty files.
Ideally, the command should work like this (The form is just to get the idea across):
set colorposition=((12,12),(14,12)), ((1,1),(1,1))
This command would, in this case, highlight (line 12, column 12) to (line 14, column 12), as well as the first position at (line 1, column 1).
One possible solution I found is using the command match.
It works like this:
let us say we would like to color the position in (column 3, line 4). We can use a certain highlight group and the command match:
highlight highlightgroup ctermbg=darkred
match highlightgroup /\%3c\%4l/
Multiple positions can be chained together using the operator \|. Highlighting position 3,4 and 1,1 would be:
match highlightgroup /\%3c\%4l\|\%1c\%1l/
The caveat is that one can only highlight positions inside the existing buffer. If one wants to highlight something at a specific position, where no text exists, the command match will not work.
A related option is available since Vim 7.3. To set the color for a whole column, e.g. 80, one can use colorcolumn.
The command colorcolumn is indifferent to the text in the buffer and works even for empty files, but it only colorizes whole columns, e.g.
set colorcolumn=80
Edit
To clarify what my goals are and to address what has been mentioned by Ingo in the answer section:
I work a lot with Fortran 77. Sometimes fixed form source code can become difficult to handle, if a certain number of IF THEN, ELSE, DO, END DO sections are used. I would like to introduce markings for every level, let's say beginning in the 81st column.
SUBROUTINE SUB(I,J)
C THE COLORCOLUMN IS VISIBLE AT C C
C=0
IF(I .GT. 0) THEN VISUAL_MARK1
IF(J. LT. 1) THEN VISUAL_MARK2
C=2
END IF VISUAL_MARK2
END IF VISUAL_MARK1
WRITE(*,*) I,J,C
END SUBROUTINE
Why would you highlight cells where no text exists?
Because Vim is a text editor, that's not supported. As you've found out, :match only highlights matching, i.e. existing text. The 'colorcolumn' is an aid for not exceeding a certain width, and as such is visible in all lines. :set virtualedit=all allows to you address non-existing positions with the cursor, but that doesn't highlight anything. The only ugly workaround I can think of is adding actual whitespace to the buffer to match those positions (and then removing them on :write).

Excel can't find a value even though it exists within the worksheet

this is my first post so i am sorry if this is confusing at all. I am trying to use a vLookup to run a comparative analysis between two reports. I am using a part number as a reference and trying to return the cost associated with the part from one of the two reports. So, the first issue that I encountered was due to the fact that some of the part numbers had letters in them and some didn't, so to be consistent I used the following code to clean up the part numbers:
IFERROR(VALUE(F11&C11), F11&C11)
where F11 and C11 are two components of the part number that needed to be concatenated to generate the full number. Now, the vLookup will not return anything except for #N/A for a few of the part numbers that are actually in the sheet. All of the part numbers are formatted the same for the 892 part numbers that I am searching for but get a returned value on 571 of the 892 part numbers but of the remaining 321 part numbers that did not have a return, about a third actually exist in my sheet. Lastly and for example, part number 110874402 exists in both sheets but gets a #N/A from the vLookup. When I copy the value from one sheet and search it in the other sheet using Ctrl + F, I get the following:
(I have an image to show but apparently can't post it without a reputation of 10 or more...oops)
The highlighted cell shows that the value exists but Excel can't find it. Does anyone have any ideas why this is or what I could be doing differently? I've been having this issue for a few months now on separate projects and haven't found any resolution.
Thanks in advance,
try =VLOOKUP("*"&TRIM(F569)&"*", BOBJ!$D$3:$P$2237, 7, FALSE) - I have a feeling spaces may have crept around the part numbers, which means that the exact match will not work.
The TRIM takes the spaces from the cell you are looking at, and the "*"'s will allow a wildcard search - note that this also means that CAT would also match CAT1, but if it produces results where there were none before, it gives you something to check for.

Resources