Free Software Directory:Participate/Script aid

From Free Software Directory
Jump to: navigation, search

Purpose

This script aims to help contributors on finding things that might be needed to consider during evaluation of the project/software.

For example, it lists all the MIME/media types of files in the current directory, so that one can find cases of files without complete and corresponding source and also find JavaScript files to look or insert GNU LibreJS syntax.

It also scans files for words related to DOM Level 0 event handlers, so that the contributor can also evaluate if there is need to add GNU LibreJS syntax.

The output is in CSV format. You can use GNU Awk to parse or query such files, before doing so, set FPAT to ([^,]*)|(\"[^\"]+\") and RS to \r\n, This variable setting was based on the related section in the GNU Awk User's Guide and on Awk's Texinfo/Info page.

You're welcome to contribute to this script and add your name and contact information to the copyright notice of the script.

Usage

Best if you take the complete corresponding source of the project being evaluated (e.g.: when using git clone, you can accomplish this using the --recursive option.

git clone --recursive [Some git repository.]
cd [Directory created by git]
[Script aid.] > [Desired text file to store output.]; printf '\a'

printf '\a' can be replaced by a command to play an audio file of your choice.

Now leave the script to do its work and wait for the sound clue to continue working on the evaluation.

Notes

  • The script is originally meant to be POSIX-compliant.
  • The script always takes the current working directory as basis of operation.
  • Be aware of false-positives.
  • Due to our lack of knowledge on various spoken languages, some things might not be found by the script.

Script

#!/bin/sh

# FSD Participation Aid: Helps user evaluate entries for the Free Software Directory.
# Copyright (C) 2016, 2018  Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@hyperbola.info>

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public
# License along with this program.  If not, see
# <https://www.gnu.org/licenses/>.

# TODO Implement minification check. The "Minified" column is
# currently for note taking of the reviewer.

printf 'Path,MIME,Charset,Copyright or license,Script tag or DOM Level 0,Minified\r\n'
find "." ! \( -name '.' -or \( -type d -or -type l \) \) \
     -exec sh -c 'file -hi "$0" \
     	      	  | sed '\''{ s/^\.\//"/g
		    	      s/: /",/g
			      s/; charset=/,/g }'\'' \
		  | tr -d "\n"' '{}' \; \
     -printf ',' \
     -exec sh -c 'grep -iq \
		       -e "\(©\)\|\((c)\)" \
		       -e "\(agreement\)\|\(acord\)" \
		       -e "\(allow\)\|\(permi\)" \
		       -e "\(copyleft\)\|\(copyright\)" \
		       -e "\(direito\)\|\(right\)" \
		       -e "\(forbid\)\|\(proh?ib\)" \
		       -e "\(law\)\|\(lei\)" \
		       -e "\(liab\)\|\(respons.?b\)" \
		       -e "\(notice\)\|\(notifica\)" \
		       -e "\(trademark\)\|\(marca\)" \
		       -e "\(warrant\)\|\(garant\)" \
		       -e "[^[:alnum:]][al]\?gpl" \
		       -e "[^[:alnum:]]as is[^[:alnum:]]" \
		       -e "[^[:alnum:]]cc" \
		       -e "[^[:alnum:]]condi" \
		       -e "[^[:alnum:]]eula" \
		       -e "[^[:alnum:]]exclusiv" \
		       -e "[^[:alnum:]]fdl" \
		       -e "[^[:alnum:]]licen" \
		       -e "[^[:alnum:]]patent" \
		       -e "[^[:alnum:]]termo?s?[^[:alnum:]]" \
		       -e "[^[:alnum:]]transfer" "$0"
		  grep_exit_status=$?
		  if [ $grep_exit_status -eq 0 ]; then
		     printf 1
		  elif [ $grep_exit_status -eq 1 ]; then
		     printf 0
		  else
		     printf $grep_exit_status
		  fi' '{}' \; \
     -printf ',' \
     -exec sh -c 'grep -iq \
     	      	       -e "[^[:alnum:]]script" \
		       -e "onabort" \
		       -e "onafterprint" \
		       -e "onautocomplete" \
		       -e "onautocompleteerror" \
		       -e "onbeforeprint" \
		       -e "onbeforeunload" \
		       -e "onblur" \
		       -e "oncancel" \
		       -e "oncanplay" \
		       -e "oncanplaythrough" \
		       -e "onchange" \
		       -e "onclick" \
		       -e "onclose" \
		       -e "oncontextmenu" \
		       -e "oncuechange" \
		       -e "ondblclick" \
		       -e "ondrag" \
		       -e "ondragend" \
		       -e "ondragenter" \
		       -e "ondragexit" \
		       -e "ondragleave" \
		       -e "ondragover" \
		       -e "ondragstart" \
		       -e "ondrop" \
		       -e "ondurationchange" \
		       -e "onemptied" \
		       -e "onended" \
		       -e "onerror" \
		       -e "onfocus" \
		       -e "onhashchange" \
		       -e "oninput" \
		       -e "oninvalid" \
		       -e "onkeydown" \
		       -e "onkeypress" \
		       -e "onkeyup" \
		       -e "onlanguagechange" \
		       -e "onload" \
		       -e "onloadeddata" \
		       -e "onloadedmetadata" \
		       -e "onloadstart" \
		       -e "onmessage" \
		       -e "onmousedown" \
		       -e "onmouseenter" \
		       -e "onmouseleave" \
		       -e "onmousemove" \
		       -e "onmouseout" \
		       -e "onmouseover" \
		       -e "onmouseup" \
		       -e "onmousewheel" \
		       -e "onoffline" \
		       -e "ononline" \
		       -e "onpagehide" \
		       -e "onpageshow" \
		       -e "onpause" \
		       -e "onplay" \
		       -e "onplaying" \
		       -e "onpopstate" \
		       -e "onprogress" \
		       -e "onratechange" \
		       -e "onreadystatechange" \
		       -e "onreset" \
		       -e "onresize" \
		       -e "onscroll" \
		       -e "onseeked" \
		       -e "onseeking" \
		       -e "onselect" \
		       -e "onshow" \
		       -e "onsort" \
		       -e "onstalled" \
		       -e "onstorage" \
		       -e "onsubmit" \
		       -e "onsuspend" \
		       -e "ontimeupdate" \
		       -e "ontoggle" \
		       -e "onunload" \
		       -e "onvolumechange" \
		       -e "onwaiting" "$0"
		  grep_exit_status=$?
		  if [ $grep_exit_status -eq 0 ]; then
		     printf 1
		  elif [ $grep_exit_status -eq 1 ]; then
		     printf 0
		  else
		     printf $grep_exit_status
		  fi' '{}' \; \
     -printf ',' \
     -printf '\r\n'


Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the page “GNU Free Documentation License”.

The copyright and license notices on this page only apply to the text on this page. Any software or copyright-licenses or other similar notices described in this text has its own copyright notice and license, which can usually be found in the distribution or license text itself.