Menu

Running MISRA without Installation

2018-11-09
2018-12-04
  • Bassam Abdul-Baki

    I have Microsoft Visual C++ 2015 Redistributable (x64) - 14.0.23026 installed at work. Unfortunately, I am not allowed to install anything else. I have the portable version of python-3.7.1 and am able to run cppcheck.exe and the GUI. However, running them with MISRA enabled gives me the following python error: "No module named 'cppcheckdata'". Any suggestions?

    Thanks!

    P.S. - I have this running at home since I can install everything there. At work it's a different beast since I am not even allowed local admin rights.

     
  • Daniel Marjamäki

    put this file in the same directory as misra.py:
    https://github.com/danmar/cppcheck/blob/master/addons/cppcheckdata.py

     
    • Bassam Abdul-Baki

      I do have it in the addons folder, along with all the other *.py files that were installed at home. It's slightly different since it's been modified recently, but I am using the same one at home.

       
  • Bassam Abdul-Baki

    BTW, I cannot install CPPCheck at work, in addition to Python. What I did was install it on my Win10 64-bit at home and copied the files to my Win7 64-bit computer at work. CPPCheck works for everything except MISRA. While Python at work is the portable version, it is installed at home. So that may be the issue, but I can't figure out what's missing.

     
  • versat

    versat - 2018-11-12

    Which version of Cppcheck do you use?
    How exactly do you start the analysis? GUI, Commandline?
    Do the other addons also not work? For example the "cert" addon?

    If you use the GUI the addon scripts should be either in the same directory as the executable or in a subfolder named "addons" (this is how they are installed). Cppcheck should be able to find them then. I remember that in earlier versions there were some problems that could prevent it, so it would be the best to use the latest version 1.85.

     
    • Bassam Abdul-Baki

      Cppcheck 1.85.
      All from the GUI.
      I haven't tried any other python addons to be honest. Since today's a holiday and I'm not at work, I'll try it tomorrow.

      Thanks!

       
    • Bassam Abdul-Baki

      None of the other addons work. I assume that it's not seeing my python path for some reason even though I add it in the GUI.

       
      • versat

        versat - 2018-11-19

        Do you have this key path in your registry?:
        [HKEY_CURRENT_USER\Software\Cppcheck\Cppcheck-GUI]
        There should then be an entry like "Python path"="C:/Python27/python.exe" in it beside others.

         
        • Bassam Abdul-Baki

          Like I said, I can't install anything at work. I can't even edit the registry. I'm just running CPPCheck at work without installation. So I guess it won't work.

           
          • versat

            versat - 2018-11-20

            Ok, if you can not even look at the registry this is hard to solve i guess.
            You can try to add the python path temporarily to the path variable.
            Running this in a .bat file for example maybe works:

            SET PATH=%PATH%;c:/python/
            cppcheckgui.exe
            
             
            • Bassam Abdul-Baki

              Thanks, but it didn't help. I guess the registry is now needed; and I don't have local admin access to install or write to the registry.

               
  • Shobana Devi Sampath

    I have installed Cppcheck 1.85 and created misrarules.text and given the path in addon Tab. But I can't see any misra warnings in the stdout after I analyse the file. could you please let me know if I have to add any other item

     
    • Bassam Abdul-Baki

      Make sure your Misra rules has the following format:
      Appendix A Summary of guidelines
      Rule 1.1
      Description of Rule 1.1.
      ...
      Rule M.N
      Description of Rule M.N.

       
  • Daniel Marjamäki

    hmm I wonder if we can be more informative when something does not match. or add some more strict format (Line 1 must say "Appendix A Summary of guidelines", Line 2 must say "Rule 1.1" etc..).

     
  • Shobana Devi Sampath

    Thank you for the reply. Should the description also contain whether it is required or advisory.
    Currenly I could style, error, information,warning and so on. Would there be different icon to display the misra warning. How does the GUI show this ?

     
    • Bassam Abdul-Baki

      As it is, the misra.py code (line 1872) reads in what type of enforcement it is. However, as seen on lines 1895-1896, it only reads it in but does not display it anywhere. So if you wish to display it with the description, I recommend you use:
      Rule 1.1
      Required - Description of Rule 1.1.

      For a more correct answer than line 2040, your Misra rules file can be of the following form (with the warning type in between the rule number and description):
      Rule 1.1
      Required
      Description of Rule 1.1.
      However, the warning line is not used when it is in its own seperate line. Thus, prepend each description with the type instead.

       
  • Daniel Marjamäki

    Would there be different icon to display the misra warning. How does the GUI show this ?

    As Bassam says, you will not get different icons.

     
  • Shobana Devi Sampath

    Hi ,

    Thank you very much for your support. Misra is working in command line. But it is not working in the GUI. Could you please let me know if I have do any changes for GUI ?

    Thanks & Regards
    Shobana

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.