To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 95b96c27 authored by scmalte's avatar scmalte
Browse files

First version of mu-moss

parent 0321a171
import mosspy import mosspy
import argparse import argparse
import logging # import logging
import pprint
DEFAULT_USER_ID="3795777", # Malte's Moss ID DEFAULT_USER_ID="3795777", # Malte's Moss ID
DEFAULT_LANGUAGE="cc" # C++ DEFAULT_LANGUAGE="cc" # C++
DEFAULT_IGNORE_LIMIT=200 # -m in Moss DEFAULT_IGNORE_LIMIT=200 # -m in Moss
DEFAULT_NUMBER_OF_MATCHING_FILES=10 # -n in Moss DEFAULT_NUMBER_OF_MATCHING_FILES=1000 # -n in Moss
DEFAULT_TEMPLATE=None DEFAULT_TEMPLATE=None
DEFAULT_FILE_PATTERN="./*/main.cpp" DEFAULT_FILE_PATTERN="./*/main.cpp"
DEFAULT_REPORT_FILE="moss-report.html" DEFAULT_REPORT_FILE="moss-report.html"
...@@ -24,8 +25,16 @@ def run_moss( ...@@ -24,8 +25,16 @@ def run_moss(
report_subdir=DEFAULT_REPORT_SUBDIR, report_subdir=DEFAULT_REPORT_SUBDIR,
connections=DEFAULT_CONNECTIONS): connections=DEFAULT_CONNECTIONS):
# Get a string representation of all function arguments, for logging purposes # Assemble Moss comment string, starting with functions (local) arguments
function_args_string = str(locals()) comments = locals()
comments["script"] = "mu-utils 0.0.1"
comment_string = str(comments)
# # A nicely formatted string representation requires a bit of hacking
# comment_string = pprint.pformat(comments, indent=2)
# comment_string = comment_string.replace("\n", "<br/>")
# comment_string = comment_string.replace(" ", "&nbsp;&nbsp;")
# Initialisation # Initialisation
logging.info("User id: {}".format(user_id)) logging.info("User id: {}".format(user_id))
...@@ -36,11 +45,11 @@ def run_moss( ...@@ -36,11 +45,11 @@ def run_moss(
# Configure # Configure
logging.info("Ignore limit: {}".format(ignore_limit)) logging.info("Ignore limit: {}".format(ignore_limit))
logging.info("Matches: {}".format(number_of_matching_files)) logging.info("Matches: {}".format(number_of_matching_files))
logging.info("Comment: {}".format(function_args_string)) # logging.info("Comment: {}".format(comment_string))
moss.setIgnoreLimit(ignore_limit) moss.setIgnoreLimit(ignore_limit)
moss.setNumberOfMatchingFiles(number_of_matching_files) moss.setNumberOfMatchingFiles(number_of_matching_files)
moss.setCommentString(function_args_string) moss.setCommentString(comment_string)
# Add template file(s) # Add template file(s)
logging.info("Template: {}".format(template)) logging.info("Template: {}".format(template))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment