category

# code_metric

> Core predicates for computing source code metrics.

author:
  `Ebrahim Azarisooreh and Paulo Moura`
version:
  `0.8`
date:
  `2018/2/18`

compilation flags:
  `static`

(no dependencies on other entities)

## Public interface

### entity/1

> Scans an entity and prints its metric score.

compilation flags:
  `static`
template:
  `entity(Entity)`
mode – number of proofs:
  `entity(+term) – zero_or_one`

### file/1

> Prints metric scores for all the entities defined in a loaded source file.

compilation flags:
  `static`
template:
  `file(File)`
mode – number of proofs:
  `file(+atom) – zero_or_one`

### directory/1

> Scans a directory and prints metric scores for all entities defined in its loaded source files.

compilation flags:
  `static`
template:
  `directory(Directory)`
mode – number of proofs:
  `directory(+atom) – one`

### rdirectory/1

> Recursive version of the directory/1 predicate.

compilation flags:
  `static`
template:
  `rdirectory(Directory)`
mode – number of proofs:
  `rdirectory(+atom) – one`

### library/1

> Prints metrics scores for all loaded entities from a given library.

compilation flags:
  `static`
template:
  `library(Library)`
mode – number of proofs:
  `library(+atom) – one`

### rlibrary/1

> Recursive version of the library/1 predicate.

compilation flags:
  `static`
template:
  `rlibrary(Library)`
mode – number of proofs:
  `rlibrary(+atom) – one`

### all/0

> Scans all loaded entities and prints their metric scores.

compilation flags:
  `static`
mode – number of proofs:
  `all – one`

### entity_score/2

> Score is a term that represents the metric score associated with a loaded entity. Fails if the metric does not apply.

compilation flags:
  `static`
template:
  `entity_score(Entity,Score)`

### library_score/2

> Score is a term that represents the metric score associated with a loaded library source files. Fails if the metric does not apply.

compilation flags:
  `static`
template:
  `library_score(Library,Score)`
mode – number of proofs:
  `library_score(@atom,-ground) – zero_or_one`

### rlibrary_score/2

> Score is a term that represents the metric score associated with loaded source files from a library and its sub-libraries. Fails if the metric does not apply.

compilation flags:
  `static`
template:
  `rlibrary_score(Library,Score)`
mode – number of proofs:
  `rlibrary_score(@atom,-ground) – zero_or_one`

### file_score/2

> Score is a term that represents the metric score associated with a loaded source file. Fails if the metric does not apply.

compilation flags:
  `static`
template:
  `file_score(File,Score)`
mode – number of proofs:
  `file_score(@atom,-ground) – zero_or_one`

### directory_score/2

> Score is a term that represents the metric score associated with loaded source files from a directory. Fails if the metric does not apply.

compilation flags:
  `static`
template:
  `directory_score(Directory,Score)`
mode – number of proofs:
  `directory_score(@atom,-ground) – zero_or_one`

### rdirectory_score/2

> Score is a term that represents the metric score associated with loaded source files from a directory and its sub-directories. Fails if the metric does not apply.

compilation flags:
  `static`
template:
  `rdirectory_score(Directory,Score)`
mode – number of proofs:
  `rdirectory_score(@atom,-ground) – zero_or_one`

### all_score/1

> Score is a term that represents the metric score associated with all loaded source files. Fails if the metric does not apply.

compilation flags:
  `static`
template:
  `all_score(Score)`
mode – number of proofs:
  `all_score(-ground) – zero_or_one`

### entity_score//2

> Pretty prints the entity score.

compilation flags:
  `static`
template:
  `entity_score(Entity,Score)`

## Protected interface

### process_entity/2

> Processes an entity of the given kind.

compilation flags:
  `static`
template:
  `process_entity(Kind,Entity)`
mode – number of proofs:
  `process_entity(+atom,@entity_identifier) – one`

### process_file/1

> Processes a source file.

compilation flags:
  `static`
template:
  `process_file(Path)`
mode – number of proofs:
  `process_file(+atom) – one`

### process_directory/1

> Processes a directory of source files.

compilation flags:
  `static`
template:
  `process_directory(Path)`
mode – number of proofs:
  `process_directory(+atom) – one`

### process_rdirectory/1

> Recursively process a directory of source files.

compilation flags:
  `static`
template:
  `process_rdirectory(Path)`
mode – number of proofs:
  `process_rdirectory(+atom) – one`

### process_rlibrary/1

> Recursively process a library of source files.

compilation flags:
  `static`
template:
  `process_rlibrary(Path)`
mode – number of proofs:
  `process_rlibrary(+atom) – one`

### process_all/0

> Processes all loaded source code.

compilation flags:
  `static`
mode – number of proofs:
  `process_all – one`

### sub_directory/2

> Enumerates, by backtracking, all directory sub-directories containing loaded files.

compilation flags:
  `static`
template:
  `sub_directory(Directory,SubDirectory)`
mode – number of proofs:
  `sub_directory(+atom,-atom) – one`

### sub_library/2

> Enumerates, by backtracking, all library sub-library paths.

compilation flags:
  `static`
template:
  `sub_library(Library,SubLibraryPath)`
mode – number of proofs:
  `sub_library(+atom,-atom) – one`

## Private predicates

(none)

## Operators

### (none)

## Remarks

### (none)

## See also

### (none)